Article ID: 153586
Article Last Modified on 6/29/2004
long _cdecl PassStr(LPSTR pStr)
{
MessageBox (NULL, pStr, "Test DLL", MB_OK);
return 1;
}
long _stdcall PassStrStdCall(LPSTR pStr)
{
return PassStr(pStr);
}
Export the functions in a .DEF file as follows:
LIBRARY TESTDLL
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD SINGLE
EXPORTS
PassStr @1
PassStrStdCall @2
Name this DLL Testdll.dll, and save the file to the Windows\System
directory in Windows 95 or Windows 98, or the Windows\System32 directory
in Windows NT or Windows 2000.
Private Declare Function PassStrStdCall Lib "testdll.dll" _
(ByVal s As String) As Long
Private Sub Form_Click()
ret& = PassStrStdCall("hello")
Print ret&
End Sub
Keywords: kbhowto kbapi KB153586