private void initFinger() { if (null == ZKFPEngX1) { //实例化OCX控件 ZKFPEngX1 = new AxZKFPEngXControl.AxZKFPEngX(); //显式调用该实例的CreateControl方法才能调用其它方法,否则在调用时系统将报AxHost.InvalidActiveXStateException异常 ZKFPEngX1.CreateControl(); //连接多个指纹采集器时,选择指纹头的序号,从0 开始;小于零时指纹采集器不工作 ZKFPEngX1.SensorIndex = 0; //取得指纹初始特征 ZKFPEngX1.OnFeatureInfo += new IZKFPEngXEvents_OnFeatureInfoEventHandler(ZKFPEngX1_OnFeatureInfo); ZKFPEngX1.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(ZKFPEngX1_OnEnroll); //指纹图片接收 ZKFPEngX1.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(ZKFPEngX1_OnImageReceived); //指纹识别系统算法引擎版本号 ZKFPEngX1.FPEngineVersion = "9"; ZKFPEngX1.Threshold = 5; } if (!ZKFPEngX1.EngineValid) { //初始化指纹识别系统 int result = ZKFPEngX1.InitEngine(); if (-2 == result) { result = ZKFPEngX1.InitEngine(); } //初始化成功 if (0 == result) { //创建指纹识别高速缓冲空间 并返回其句柄 CreateFPCacheDBEx(); } else if (1 == result) { endFinger(); throw new Exception("指纹识别驱动程序加载失败"); } else if (2 == result) { endFinger(); throw new Exception("没有连接指纹识别仪"); } else { endFinger(); throw new Exception("指定的指纹仪不存在"); } } ZKFPEngX1.FlushFPImages(); }