[求助]如何调用带参数的DLL函数?
我用VC++6.0写了一个DLL,里面有两个函数,一个是不带参数的,一个是带参数的,
不带参数的我会调用,带参数的我不会,
请问在 VB6.0 和 VC++6.0 中分别怎么调用?
extern "C" __declspec(dllexport)int sum(int a,int b)
{
int s=a+b;
return s;
}
extern "C" __declspec(dllexport)int abc()
{
int i=5;
return i+5;
}
在VB中,首先
Private Declare Function sum Lib "d1.dll" (ByVal a As Integer, ByVal b As Integer) As Integer
Private Declare Function abc Lib "d1.dll" () As Integer
然后
Private Sub Command1_Click()
Dim r As Integer
r = abc
Text1.Text = r
End Sub
调用没有问题,但是:
Private Sub Command2_Click()
Dim h As Integer
h = sum(4,5) 这里有问题,不知道怎么调用?
Text2.Text = h
End Sub