vb6:如何在连接到智能卡时包括定义的.dll



我有来自智能卡读卡器提供商的示例代码。

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,我需要包含它才能读取插入的卡。

请注意,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)

相关内容

  • 没有找到相关文章

最新更新