如何在C#项目中使用ZK4500指纹扫描仪SDK [英] How to use ZK4500 Fingerprint Scanner SDK in C# Project
问题描述
我正在用C#开发一个项目,我想使用其指纹来登录/验证用户.
I am developing a project in C#, for which I want to login/authenticate a user using their fingerprint.
我购买了ZK4500指纹扫描仪,并从 http://www.zkteco获得了SDK. com/product/ZK4500_238.html .该SDK使用C ++.
I bought a ZK4500 Fingerprint scanner and got its SDK from http://www.zkteco.com/product/ZK4500_238.html. The SDK is in C++.
那么我如何将该SDK与C#项目集成在一起以执行所需的功能?
So How can I integrate this SDK with my C# project to perform the desired functionality?
推荐答案
您需要添加对ZKFPEngXControl的引用,该引用将出现在COM类型库下.之后,您可以使用ZKFPEngX类执行所需的任何操作.
You need to add reference to ZKFPEngXControl that will appear under COM Type Libraries. After that you can use the ZKFPEngX Class to do whatever you require.
using ZKFPEngXControl;
然后
ZKFPEngX fp = new ZKFPEngX();
fp.SensorIndex = 0;
fp.InitEngine(); // Do validation as well as it returns an integer (0 for success, else error code 1-3)
//subscribe to event for getting when user places his/her finger
fp.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(fp_OnImageReceived);
您可以编写自己的方法fp_OnImageReceived来处理事件.例如,您可以在该方法中编写该代码;
You can write your own method fp_OnImageReceived to handle the event. for example you can write this in that method;
object imgdata = new object();
bool b = fp.GetFingerImage(ref imgdata);
其中imgdata是字节数组.您还可以在ZKFPEngX中使用其他方法来实现目标.请记住在表单关闭时关闭引擎.
Where imgdata is an array of bytes.You can also use other methods in ZKFPEngX, to achieve your goals. Remember to close the engine when form closes.
fp.EndEngine();
这篇关于如何在C#项目中使用ZK4500指纹扫描仪SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!