'System.Runtime.InteropServices.COMException' in Interop.ZKFPEngXControl.dll (0x80040202)

1.7k views Asked by At

I am developing a winform fingerprint reader application using ZKFinger SDK.
When i am running following code:

ZKFPEngXClass obj = new ZKFPEngXClass();
obj.OnImageReceived += Obj_OnImageReceived;
obj.OnCapture += Obj_OnCapture;
obj.OnEnroll += Obj_OnEnroll;
obj.OnFeatureInfo += Obj_OnFeatureInfo;

then i get error on

 obj.OnCapture += Obj_OnCapture;
 obj.OnEnroll += Obj_OnEnroll;
 obj.OnFeatureInfo += Obj_OnFeatureInfo;

but

obj.OnImageReceived += Obj_OnImageReceived;

works fine.

Error is

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Interop.ZKFPEngXControl.dll".
Additional information: Exception from HRESULT: 0x80040202

2

There are 2 answers

3
Ozesh On

You should register those events only after you connect to the device.

        if (objCZKEM.Connect_Net(IPAdd, Port))
        {
            //65535 or 32767- depends
            if (objCZKEM.RegEvent(1, 32767))
            {
                // [ Register your events here ]
                // [ Go through the _IZKEMEvents_Event class for a Ex);
            }
            return true;
        }
0
AHeine On

Instead of using

ZKFPEngXClass obj = new ZKFPEngXClass();

use

ZKFPEngXControl.ZKFPEngX obj = new ZKFPEngXControl.ZKFPEngX();

Hope it helps.