Foxtable(狐表)用户栏目专家坐堂 → 关于引用托管DLL文件的,求解?


  共有3088人关注过本帖树形打印复制链接

主题:关于引用托管DLL文件的,求解?

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 10:41:00 [显示全部帖子]

 读卡器,一般都是非托管dll,具体要看人家给的开发文档怎么说。

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 10:52:00 [显示全部帖子]

 读卡器,都是非托管dll,直接拷贝到foxtable的安装目录下,参考

 

http://www.foxtable.com/help/topics/2664.htm

 


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 11:11:00 [显示全部帖子]

  你去打开人家 vb.net 的例子,看人家的代码是怎么写的。

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 11:12:00 [显示全部帖子]

比如

 

 Declare Function mw_dev_openReader Lib "mwCardReader.dll" (ByVal name As String, ByRef devNo As Int32, ByVal param1 As UInt32, ByVal param2 As UInt32) As Int32
    Declare Function mw_dev_beep Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal beepTimes As Byte, ByVal interval As Byte, ByVal time As Byte) As Int32
    Declare Function mw_dev_reset Lib "mwCardReader.dll" (ByVal devNo As Int32) As Int32
    Declare Function mw_dev_closeReader Lib "mwCardReader.dll" (ByVal devNo As Int32) As Int32
    Declare Function mw_dev_readVer Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal readVer As String) As Int32
    Declare Function mw_mifare_openCard Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal openMode As Byte, ByVal cardUid As String) As Int32
    Declare Function mw_mifare_closeCard Lib "mwcardReader.dll" (ByVal devNo As Int32) As Int32
    Declare Function mw_mifare_authentication Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal mode As Byte, ByVal sector As UInt32, ByVal key As String) As Int32
    Declare Function mw_mifare_read Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal blockNO As UInt32, ByRef blockData As Byte) As Int32
    Declare Function mw_mifare_write Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal blockNO As UInt32, ByRef blockData As Byte) As Int32

    Declare Function mw_ext_ascToHex Lib "mwCardReader.dll" (ByVal asc As String, ByVal srcLen As Integer, ByRef hex As Byte) As Int32
    Declare Function mw_ext_hexToAsc Lib "mwCardReader.dll" (ByRef hex As Byte, ByVal srcLen As Integer, ByVal asc As String) As Int32

    Declare Function mw_cpu_reset Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal CardSeat As UInt32, ByRef returnData As Byte, ByRef arcLen As UInt16) As Int32
    Declare Function mw_cpu_apdu Lib "mwCardReader.dll" (ByVal devNo As Int32, ByVal cardSeat As UInt32, ByRef apduData As Byte, ByVal len As UInt32, ByRef returnData As Byte, ByRef relen As Int32) As Int32


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 11:32:00 [显示全部帖子]

 vb.net的语法就是foxtable的语法。

 

 你打开人家的例子,看看人家代码怎么写。


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 15:59:00 [显示全部帖子]

 全局代码定义

 

Public devNo As Int32
Public st As Int32

 

 然后,把设备打开。代用函数直接写

 

st = mw_dev_led(devNo,1)


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 16:32:00 [显示全部帖子]

直接写就行啊,有代码你也不会抄么

 

Dim readVer As New String(readVer, 20)

st = mw_dev_readVer(devNo, readVer)

If (st = 0) Then
    msgbox("read Version ok!   " + readVer)
Else
    msgbox("read Version error!")
End If

[此贴子已经被作者于2015/5/26 16:31:53编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/5/26 16:34:00 [显示全部帖子]

先连接

 

Dim designation As New String(designation, 10)

designation = "USB1"
st = mw_dev_openReader(designation, devNo, 2, 0)
If (st = 0) Then
    msgbox("Open CardReader ok!")
Else
    msgbox("Open CardReader error!")
End If


 回到顶部