VC DLL:
BOOL __stdcall LEDShowCharge(byte addr,byte ledaddr,int staytime,int charge);VB :
Declare Function LEDShowCharge Lib "CardPc300.dll" (ByVal Addr As Byte, ByVal ledaddr As Byte, ByVal stattime As Long, ByVal charge As Long) As BooleanPrivate Sub LEDShowCharge_Click()
 Dim stattime As Long
 Dim charge As Long
 Dim test As Byte
    stattime = 20
    charge = 5
    test = 25
 If LEDShowCharge(1, 255, stattime, charge) Then
  MsgBox ("设置收费成功")
  Else
   MsgBox ("失败!")
   End If
End Sub
结果出现 “错误地参数号或是无效地属性赋值” 的错误。查看LEDShowCharge(1, 255, stattime, charge)的定义时提示说什么被隐藏了。这VB代码是我同事写的,VC DLL是我写的,不知道会不会是我DLL的问题,但是我用VC DELPHI调用的时候都正常啊

解决方案 »

  1.   

    1、 你的DLL中函数导出了吗?
    2、如果DLL已经导出出现这个问题,把VB的声明返回参数用long 替换boolean试试
      

  2.   

    函数有导出,我用delphi调用也很正常。
      

  3.   


    Declare Function LEDShowCharge Lib "CardPc300.dll" (ByVal Addr As Byte, ByVal ledaddr As Byte, ByVal stattime As Long, ByVal charge As Long) As Long---------------------------C:
    #define TRUE 1
    #define FALSE 0BOOL = int 
    bool = byteVB:
    True = -1
    False = 0Boolean = byte 
     
      

  4.   

    我已经找到问题了,是他把函数名又拿去当按钮的名字,唉,都是些小错误。真是的。
    不过我觉得VB代码看起来好乱啊,不太喜欢VB呵呵
    谢谢各位了