我从智能卡读卡器提供商那里获得了这个示例代码。
retCode = SCardConnect(hContext, _
cbReader.Text, _
SCARD_SHARE_EXCLUSIVE, _
SCARD_PROTOCOL_T0 Or SCARD_PROTOCOL_T1, _
hCard, _
Protocol)
它的作用是连接到智能卡。SCardConnect 的函数声明如下:
Public Declare Function SCardConnect Lib "Winscard.dll" Alias "SCardConnectA" (ByVal hContext As Long, _
ByVal szReaderName As String, _
ByVal dwShareMode As Long, _
ByVal dwPrefProtocol As Long, _
ByRef hCard As Long, _
ByRef ActiveProtocol As Long) As Long
我还有另一个 .dll 功能,我希望它在连接到智能卡时包含在其中。
Declare Function MineKad Lib "mineKad.dll" (ByVal field As Long, ByVal buffer As Any, resultLength As Long) As Long
我试试这个:
retCode = SCardConnect(MineKad, _
hContext, _
cbReader.Text, _
SCARD_SHARE_EXCLUSIVE, _
SCARD_PROTOCOL_T0 Or SCARD_PROTOCOL_T1, _
hCard, _
Protocol)
但是失败了...那么我如何在连接到智能卡的同时连接 MineKad...MineKad 是 SDK,我需要包含它才能读取插入的卡。