hey Friends,
I want a simple help from you,
I want a code that how to catch event of finger put on machine and how to catch the signal(message) from fingerprint machine (Like finger is valid or not)
I have a code to connect with fingerprint device as below

int count = 0;
        zkemkeeper.CZKEMClass axczkem1 = new zkemkeeper.CZKEMClass();
        bool bIsConnected = false;
        string ip = "192.168.1.170";//write here IP Address of your biomatric m/c
        int port = 4370;
        bIsConnected = axczkem1.Connect_Net(ip, port);
        if (bIsConnected == true)
        {
            Label1.Text = "Connection established!!!";

            bool ret = axczkem1.ReadAllGLogData(1);
            if (ret)
            {
                int a = 0;
                int b = 0;
                int c = 0;
                int d = 0;
                int ee = 0;
                int f = 0;
                int g = 0;
                int h = 0;
                int i = 0;
                int j = 0;
                int k = 0;
                int l = 0;
                int m = 0;
                int n = 0;
                int o = 0;
                while (axczkem1.GetAllGLogData(1, ref a, ref b, ref c, ref k, ref l, ref d, ref m, ref ee, ref f, ref g))
                {
                    //if (ee == 7 && m == 4 && d == 2011)
                    {
                        count++;
                        //if (b == //any Employee No)
                        //{
                        Label1.Text = b.ToString() + " hour: " + f + "  Min: " + g;
                        //Label1.Text=k.ToString() + " " + l.ToString();

                        //}
                    }

                }
                //MessageBox.Show(count.ToString ());
            }

        }
        else
            Label1.Text = "cannot Connection!!!";

        axczkem1.Disconnect();

But i dont know how to implement further,
Please any one help me
The connection is establish successfully but i dont know about other events like finger putting on machine,catch message sent by machine
Thanks

Dani AI

Generated

already has a successful LAN connection (Connect_Net). For LAN devices the next step is to register real‑time events and attach handlers so the device will push “finger placed” and verification/attendance messages instead of the polling loop that reads stored logs. The SDK exposes a RegEvent(dwMachineNumber, EventMask) API and a set of events (OnFinger, OnVerify, OnAttTransaction / OnAttTransactionEx, etc.). Using EventMask = 65535 registers all real‑time events. (studylib.net)

Minimal, reliable flow (works for WinForms, console or service — but see STA/thread note below):

  • instantiate CZKEMClass on a thread with a COM message pump (or on the UI thread),
  • subscribe to OnConnected/OnDisConnected,
  • Connect_Net(...),
  • call RegEvent(machineNumber, mask),
  • subscribe to OnFinger, OnVerify, OnAttTransactionEx and handle the callbacks.

Example skeleton (C#):

Thread t = new Thread(() =>
{
    var zk = new zkemkeeper.CZKEMClass();

    zk.OnConnected += new zkemkeeper._IZKEMEvents_OnConnectedEventHandler(OnConnected);
    zk.OnDisConnected += new zkemkeeper._IZKEMEvents_OnDisConnectedEventHandler(OnDisconnected);

    if (zk.Connect_Net("192.168.1.170", 4370))
    {
        int machineNumber = 1;
        if (zk.RegEvent(machineNumber, 65535))
        {
            zk.OnFinger += new zkemkeeper._IZKEMEvents_OnFingerEventHandler(OnFinger);
            zk.OnVerify += new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(OnVerify);
            zk.OnAttTransactionEx += new zkemkeeper._IZKEMEvents_OnAttTransactionExEventHandler(OnAttTransactionEx);
        }
    }

    Application.Run(); // required message loop for COM events
});
t.SetApartmentState(ApartmentState.STA);
t.IsBackground = true;
t.Start();

Add simple handlers such as OnFinger() (finger placed), OnVerify(int userId) (verification callback) and OnAttTransactionEx(...) (attendance record, timestamp and flags). (stackoverflow.com)

Troubleshooting checklist:

  • Confirm RegEvent returned true and, if not, call GetLastError to get the SDK error code.
  • Events require an STA thread with a message loop for COM callbacks (console/services commonly miss this). If using a Windows Service, create a dedicated STA thread and call Application.Run there. (stackoverflow.com)
  • Make sure the interop/zkemkeeper DLL matches process bitness (32 vs 64‑bit) and is properly registered; mismatched bitness often explains “no events” issues. (lawebdelprogramador.com)

If realtime push isn’t available on the specific device/firmware, fall back to periodic polling (ReadRTLog/GetRTLog or ReadGeneral/ReadAll logs) and filter new records. OnAttTransactionEx carries the enroll ID and timestamp fields so it’s suitable for deciding “valid/invalid” and recording attendance. (q.cnblogs.com)

(For reference: ’s COM question was useful — for LAN the Connect_Net + RegEvent approach above is correct.)

Recommended Answers

All 2 Replies

Is the device connected via COM port ?

via lan cable

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.