全局代码
Default
Public Declare
Function UCommand1 Lib "RdCard.dll" (ByRef pCmd As Byte, ByRef para0
As Integer, ByRef para1 As Integer, ByRef para2 As Integer) As Integer
内部函数
idload
Dim cmd As Byte
Dim
nRet,para0,para1,para2 As Integer
cmd = 65 '0x41初始化端口
para0 = 0
para1 = 8811
para2 = 9986
nRet =
UCommand1(cmd, para0, para1, para2)
Vars("VnRet")=nRet
If nRet = 62171
Then
forms(Vars("currForm")).TimerEnabled = True
Forms(Vars("currForm")).Controls("Label22").Text
= "设备连接成功!"
Else
Forms(Vars("currForm")).TimerEnabled = False
Forms(Vars("currForm")).Controls("Label22").Text =
nRet.tostring + "身份证读卡器未连接!"
messagebox.show("设备未连接,请确保设备连接正常!")
End If
IdScan
Dim cmd As Byte
Dim
nRet,para0,para1,para2 As Integer
Dim bRun As
Boolean
Dim tbl As Table =
Tables("Person_info")
If Not bRun Then
bRun = True
Forms(Vars("currForm")).Controls("Label22").Text =
"請放置身份证..."
cmd = 67 '0x43驗證卡
para0 = 0
para1 = 8811
para2 = 9986
nRet = UCommand1(cmd, para0, para1,
para2) '驗證卡
If nRet = 62171 Then
Forms(Vars("currForm")).Controls("Label22").Text =
"正在讀卡..."
cmd = 68 '0x44 讀卡內信息
para0 = 0
para1 = 8811
para2 = 9986
nRet = UCommand1(cmd, para0, para1,
para2) '讀卡內信息
If nRet = 62171 Then
Functions.Execute("Parse")
Dim txt As String =Vars("idcard")
If txt = "" Then
Else
'具体实现功能的代码
End If
ElseIf nRet = -5 Then
MessageBox.Show("軟件未授權","提示")
End If
End If
bRun = False
End If
parse
Dim Info As String
Info = FileSys.ReadAllText(ApplicationPath
& "wx.txt", Encoding.Default) '读取生成的文本文件
info =
info.Replace(vbcrlf,vblf) '将回车换行替换为换行
Dim pars() As
String = Info.Split(vblf) '将读取的信息拆分为数组
Vars("name")=pars(0).Trim()
Vars("sex")=pars(1).Trim()
Vars("minzu")=pars(2).Trim()
Vars("bdate")=pars(3)
Vars("address")=pars(4)
Vars("idcard")=pars(5)
Vars("issue")=pars(6)
Vars("issued_date")=pars(7)
Vars("limit_date")=pars(8)
FileSys.CopyFile(ApplicationPath
& "zp.bmp", ProjectPath & "\Attachments\" &
Vars("idcard") & ".bmp",True)
'照片复制到Attachments目录
可以试试看