I'm trying to call a Visual C DLL from a
Visual Basic program.
I've searched for examples hi & low and the only one I found only
showed how to pass to integers by value. I need to call a DLL by passing
integers, strings and arrays and upon return, the values need to be
modified from the DLL.
I've included the simple example I found in a book. I would appreciate if
someone could give me an example of a VB call to a Visual C DLL, passing
an integer, string & array by reference. If someone could recommend a book
that goes into calling DLL's from Visual Basic, I would appreciate that
also.
Thanks!!
Bill
*** Visual Basic Calling Code Example ***
Declare Function SimpleCalc Lib "H:\2a\vb\testdll\scalcwin"
(ByVal Parm1%, ByVal Parm2%) As Integer
Private Sub Command1_Click()
Dim Parm1 As Integer
Dim Parm2 As Integer
dim RC as Integer
Parm1 = 10
Parm2 = 20
RC = SimpleCalc(Parm1, Parm2)
End Sub
*** Visual C 1.5 DLL Example ***
/**************
* SCALCWIN.C *
**************/
#include <string.h>
#include <windows.h>
int _far _Pascal SimpleCalc(int Parm1, int Parm2);
int _far _pascal SimpleCalc(int Parm1, int Parm2)
{
return (Parm1 * Parm2);
Quote:
}