首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

求VB代码转PB,该如何解决

2012-02-09 
求VB代码转PBPrivate Declare Function UCommand1 Lib RdCard.dll (ByRef pCmd As Byte, ByRef para0 As

求VB代码转PB
Private Declare Function UCommand1 Lib "RdCard.dll" (ByRef pCmd As Byte, ByRef para0 As Long, ByRef para1 As Long, ByRef para2 As Long) As Long

Dim cmd As Byte
Dim para0 As Long
Dim para1 As Long
Dim para2 As Long

cmd = 65 '0x41
para0 = 0
para1 = 8811
para2 = 9986
   
nRet = UCommand1(cmd, para0, para1, para2)
If nRet = 62171 Then
  Timer1.Enabled = True
  txtMsg.Caption = nRet
  txtMsg.Caption = txtMsg.Caption + "连接机具成功"
Else
  Timer1.Enabled = False
  txtMsg.Caption = nRet
  txtMsg.Caption = txtMsg.Caption + "连接机具失败"
End If

-----------------------------------

转成PB:
Function Integer UCommand1(char pCmd,integer parg0,integer parg1,integer parg2) Library RdCard.dll'

char cmd
cmd = char(41)
UCommand1(cmd,0,8811,9986)
IF nRet = 62171 THEN
  MessageBox('1','OK')
ELSE
  MessageBox('NO',nRet)
END IF



[解决办法]
你那api函数中的参数是不是都是引用传递的,参数前应该加ref啊?
Function Integer UCommand1( ref char pCmd,ref integer parg0,ref integer parg1,ref integer parg2 ) Library RdCard.dll'

热点排行