Код для VB6
- Код: Выделить всё
Declare Function SCardComand Lib "SCARD32" (ByVal Handle As Long, ByVal Cmd As String, ByVal CmdLen As Long, ByVal DataIn As String, ByVal DataInLen As Long, ByVal DataOut As String, ByVal DataOutLen As Long) As Long
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ret As Long
ret = SCardComand(0, "Device,SearchComPort,1", 0, 0, 0, 0, 0)
If ret = 0 Then MsgBox("OK") Else DisplayError(ret)
End Sub
Теперь переделываю код для .NET
- Код: Выделить всё
Declare Function SCardComand Lib "scard32" (ByRef Handle As Int32, ByRef Cmd As String, ByRef CmdLen As Int32, ByRef DataIn As String, ByRef DataInLen As Int32, ByRef DataOut As String, ByRef DataOutLen As Int32) As Int32
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim ret As Long
ret = SCardComand(0, "Device,SearchComPort,1", 0, 0, 0, 0, 0)
If ret = 0 Then MsgBox("OK") Else DisplayError(ret)
End Sub
На VB6 программа работает на ура, на VB.NET получаю ответ от библиотеки, что команды ей не понятны. Но команды же одни и теже...
Кто может сталкивался?