[DllImport("sdtapi.dll")]
static extern IntPtr InitComm(IntPtr iPort);
[DllImport("sdtapi.dll")]
static extern IntPtr CloseComm();
[DllImport("sdtapi.dll")]
static extern IntPtr Authenticate();
[DllImport("sdtapi.dll")]
static extern IntPtr Routon_IC_HL_ReadCardSN(StringBuilder SN);
[DllImport("sdtapi.dll")]
static extern IntPtr HID_BeepLED(bool BeepON, bool LEDON, Int32 duration);
int port = 1001;
IntPtr ret = InitComm(new IntPtr(port));
if (ret.ToInt32() > 0)
{
ret = Authenticate();
if (ret.ToInt32() > 0)
{
//身份证
}
else
{
StringBuilder msg = new StringBuilder();
ret = Routon_IC_HL_ReadCardSN(msg);
label1.Text="卡号:" + msg;
HID_BeepLED(true, true, 10);
}
CloseComm();
}
C#读IC卡
最新推荐文章于 2024-07-15 19:19:54 发布