Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Team,

I have purchased your SDK for biometric scanner from a dealer from India.

I am using zkemkeeper.dll, while interfacing Biometric scanner with C# code.

I am using the handler OnAttTransactionExEventHandler for getting the update when a finger is pressed on the terminal. This works fine when interacting with code written in Windows Forms.

Issue:

When I am using this same event handler, with Windows Service written with C# code.
The handler does not work, i.e. when finger is pressed on the Biometric terminal the handler method does not get fired.
I am also using regEvent(deviceid,1) for all OnAttTransaction/OnAttTransactionEx and also used regEvent(deviceid,65532) for registering all events, but still same problem.
I have written the whole code in OnStart(), biometric machine also gets connected, but handler is not firing up.

Needed Working:

I have created a windows service, which will be started on a windows 7 64-bit machine.
I have used Biometric scanner with SDK 6.0.3.3 and zkemkeeper.dll version 2.0.0.1. When user places the finger on scanner, OnAttTransactionExEventHandler must fire to perform the action written in this method.

Please help me out as am stuck for this issue.

Thanks in advance,
Nitesh
Posted
Comments
jose raymundo aviles rios 20-Jul-17 14:01pm    
can you teach me hot to works?

1 solution

Try this:
C#
myCZKEMClass = new CZKEMClass();

Thread createComAndMessagePumpThread = new Thread(() =>
{
    myCZKEMClass.Connect_Net("192.168.1.20", 4370);


    if (myCZKEMClass.RegEvent(1, 65535))
    {
        myCZKEMClass.OnAttTransactionEx += new _IZKEMEvents_OnAttTransactionExEventHandler(myCZKEMClass_OnAttTransactionEx);
    }

    Application.Run();
});
createComAndMessagePumpThread.SetApartmentState(ApartmentState.STA);

createComAndMessagePumpThread.Start();

eventLog1.WriteEntry("Service Started");

Put the code inside Start method of the service. You need to add a reference to System.Windows.Form library.
But this SDK seems have another problem, the event will stop working after couple mins if you let the service idle (same thing happened to WinForms too). I'm not sure if it's only me who had this problem, but the code samples gave me same result.
 
Share this answer
 
v3
Comments
jose raymundo aviles rios 20-Jul-17 14:00pm    
can you teach me how to work this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900