|
-
October 26th, 1999, 10:35 AM
#1
Calling DLL from VB
Hi, everyone !
I am a beginner to Visual Basic programming. Please help me.
What I want to do is to call a function in a dll created by C++.
C++ source code :
extern "C" __declspec(dllexport) long DllTest2(int *pMode);
__declspec(dllexport) long DllTest(int *pMode)
{
*pMode = 221;
return 725;
}
My Basic Code :
Private Declare Function DllTest Lib "dtest.dll" (ByRef mode as Long) As Long
Dim mode As Long
Private Sub Command1_Click()
res = DllTest(Mode)
End Sub
It's very simple code, but I always got runtime error #49, telling me that I violated calling rule.
(Help tells me that something is wrong in argument type).
Please help me !
What's wrong with my code ?
Thanks in advance.
J. Lee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|