DLL调用出错
要调用一个BCB写的DLL,在窗体里定义做如下定义Public Declare Function ABC_login Lib ".\Dll.dll" (ByVal date1 As String, ByVal time1 As String, ByVal ErrCode As String, ByVal ErrMsg As String) As Integer
运行时出现下面的错误
Constants,fixed-length strings,array,user-defined types and Declare statements not allowed as Public members of object modules
如果把public改成private就不出错,请高手指点 --------------------编程问答-------------------- Public Declare Function ABC_login Lib "C:\Windows\System32\Dll.dll" (ByVal date1 As String, ByVal time1 As String, ByVal ErrCode As String, ByVal ErrMsg As String) As Integer
你的声明是错误的,你要把声明中Dll文件的路径写成绝对路径,或者将该Dll放置到C:\Windows\System32目录下,然后如下声明:
Public Declare Function ABC_login Lib "Dll.dll" (ByVal date1 As String, ByVal time1 As String, ByVal ErrCode As String, ByVal ErrMsg As String) As Integer
--------------------编程问答-------------------- 改成绝对路径或放在C:\Windows\System32都不行, --------------------编程问答-------------------- public通常用在.bas模块文件中 --------------------编程问答-------------------- 放在哪都不行 --------------------编程问答-------------------- 你确定你的声明没有问题?比如类型的声明?传递方式? --------------------编程问答-------------------- 在窗体中,必须用 Private 关键字。
要 Public,就必须放到模块中。
补充:VB , API