我有来自智能卡读卡器提供商的示例代码。
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。
答案 0 :(得分:0)
请注意,SCardConnectA
需要6个参数:
ByVal hContext As Long, _
ByVal szReaderName As String, _
ByVal dwShareMode As Long, _
ByVal dwPrefProtocol As Long, _
ByRef hCard As Long, _
ByRef ActiveProtocol As Long
在这里你传递7:
retCode = SCardConnect(MineKad, _
hContext, _
cbReader.Text, _
SCARD_SHARE_EXCLUSIVE, _
SCARD_PROTOCOL_T0 Or SCARD_PROTOCOL_T1, _
hCard, _
Protocol)
这是否有效?
retCode = SCardConnect(hContext, _
cbReader.Text, _
SCARD_SHARE_EXCLUSIVE, _
SCARD_PROTOCOL_T0 Or SCARD_PROTOCOL_T1, _
hCard, _
Protocol)