有没有人调用过IC卡(Mifare)的各种标准动态函数,或者对DLL文件各种参数的使用很熟的,很急啊,愿意拿出500作为交流

haj77 2003-05-16 04:20:42
有用c++build写的DLL, 由于第一次使用VB, 对DLL上面的参数在VB中重新定义不熟悉,
比喻unsigned char * 在VB中是定义成byref a() as byte 还是Byval a as string 拿不定主意,并且好像都可以!! DLL文件主要是IC卡上面的标准调用,象Request、Anticoll、select、Read等等依此函数,本人愿意高分拿出交流,如果做过ic卡或对DLL相当熟悉的,留下Email, 解答问题愿意给高分.
...全文
37 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
of123 2003-05-23
RFMifare_Read(52, ReadBuff(0))中ReadBuff(0)是地址指针,指向下标为零的单元,即起始地址。
你事先要声明数组
Public ReadBuff(16) As Byte
回复
haj77 2003-05-19
并且现在有个怪问题,在使用Mifare_Read函数时,如果将buffer定义成byref buffer as byte
类型时,运行函数报xxxxx地址不能为"read"错误?
回复
haj77 2003-05-19
of123() ,看了你的Mifare卡调用函数,在RFMifare_Read(52, ReadBuff(0))中,你ReadBuff
定义长度为0, 使用函数后可以看到返回数据吗? 我可以用Email与你交流吗?
回复
of123 2003-05-16
都可以。不过当a的值不是字符时,最好用byref a() as byte,否则中文VB会自动处理字符串,弄成无法复原的乱码。

Declare Function RFMifare_Request Lib "advic32.dll" (ByVal mode As Long, cardtype As Long) As Long
Declare Function RFMifare_AntiColl Lib "advic32.dll" (CardSnr As Long) As Long
Declare Function RFMifare_Select Lib "advic32.dll" (ByVal CardSnr As Long) As Long
Declare Function RFMifare_LoadKey Lib "advic32.dll" (ByVal mode As Long, ByVal sector As Long, key As Byte) As Long
Declare Function RFMifare_Authentication Lib "advic32.dll" (ByVal mode As Long, ByVal sector As Long, ByVal blockno As Long) As Long
Declare Function RFMifare_Read Lib "advic32.dll" (ByVal blockno As Long, ReadBuff As Byte) As Long

例子:
status = RFMifare_Request(1, cdtype)
If status = 0 Then
If cdtype <> 4 And cdtype <> 16 Then
MsgBox "非门禁用卡!"
Exit Sub
End If
Else
StatusBar1.Panels(3) = " 呼叫失败"
Exit Sub
End If

status = RFMifare_AntiColl(cdsnr)
If status <> 0 Then
StatusBar1.Panels(3) = "防碰撞选择失败"
Exit Sub
End If

status = RFMifare_Select(cdsnr)
If status <> 0 Then
StatusBar1.Panels(3) = " 卡激活失败"
Exit Sub
End If


status = RFMifare_LoadKey(4, 13, ymima(0))
If status <> 0 Then
StatusBar1.Panels(3).Text = " 密码传送失败!"
Exit Sub
End If

status = RFMifare_Authentication(4, 13, 55)
If status <> 0 Then
StatusBar1.Panels(3).Text = " 密码校验失败!"
Exit Sub
End If

status = RFMifare_Read(52, ReadBuff(0))
......
回复
zhp80 2003-05-16
byref a() as byte or Byval a as string 是都可以,不过在VB中用Byval a as string 更符合VB的Style,因为string是BSTR,VB中的字符串都是BSTR,用Byval a as string 多数情况下操作会简单一些的;
但VB中字符都是DBCS的,因此在做一些底层的操作试会又麻烦,所以有时用byref a() as byte 写起来既丢失了VB的建议性,又不像c/c++的指针那样流畅,但不会为一些莫名其妙的问题去排错
我在做通讯时都用a() as byte
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7492

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-16 04:20
社区公告
暂无公告