I am working on a time attendance software that work with biometric time attendance device. The vendor of the device provided a COM Class library "zemkeeper" that you have to register and link to it.
In the demo they provided they used it in GUI winform app and it works and it worked for me too.
zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
bool bIsConnected = axCZKEM1.Connect_Net(txtIP.Text, Convert.ToInt32(txtPort.Text));
if (bIsConnected == true)
{
btnConnect.Text = "DisConnect";
btnConnect.Refresh();
lblState.Text = "Current State:Connected";
iMachineNumber = 1;//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
if (axCZKEM1.RegEvent(iMachineNumber, 65535))//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
{
this.axCZKEM1.OnFinger += new zkemkeeper._IZKEMEvents_OnFingerEventHandler(axCZKEM1_OnFinger);
...
}
}
else
{
axCZKEM1.GetLastError(ref idwErrorCode);
MessageBox.Show("Unable to connect the device,ErrorCode=" + idwErrorCode.ToString(), "Error");
}
}
But when I tried to build a windows service the registered event doesn't fire at all. I tried to do the same thing using a console app but it doesnt work too.
What is the problem ? does this type of COM object require a GUI to be able to handle events ? if yes is their any work around it ?
Thanks in advance.