1、全局代码
<DllImport("sdtapi.dll", CallingConvention := CallingConvention.StdCall)> _
public Function SDT_StartFindIDCard(iPort As Integer, pucManaInfo As Byte(), iIfOpen As Integer) As Integer
End Function
<DllImport("sdtapi.dll", CallingConvention := CallingConvention.StdCall)> _
public Function SDT_SelectIDCard(iPort As Integer, pucManaMsg As Byte(), iIfOpen As Integer) As Integer
End Function
<DllImport("sdtapi.dll", CallingConvention := CallingConvention.StdCall)> _
public Function SDT_ReadBaseMsg(iPort As Integer, pucCHMsg As Byte(), ByRef puiCHMsgLen As UInt32, pucPHMsg As Byte(), ByRef puiPHMsgLen As UInt32, iIfOpen As Integer) As Integer
End Function
2、调用代码
'变量声明
Dim CardPUCIIN As Byte() = New Byte(254) {}
Dim pucManaMsg As Byte() = New Byte(254) {}
Dim pucCHMsg As Byte() = New Byte(254) {}
Dim pucPHMsg As Byte() = New Byte(3023) {}
Dim puiCHMsgLen As UInt32 = 0
Dim puiPHMsgLen As UInt32 = 0
Dim st As Integer = 0
'读卡操作
st = SDT_StartFindIDCard(1, CardPUCIIN, 1)
If st <> &H9f Then
Return
End If
st = SDT_SelectIDCard(1, pucManaMsg, 1)
If st <> &H90 Then
Return
End If
st = SDT_ReadBaseMsg(1, pucCHMsg, puiCHMsgLen, pucPHMsg, puiPHMsgLen, 1)
If st <> &H90 Then
Return
End If
'显示结果
msgbox(System.Text.ASCIIEncoding.Unicode.GetString(pucCHMsg))
[此贴子已经被作者于2016/6/28 15:26:45编辑过]