Visual basic 6 - linking to a dll file ?
Posted on 2006-06-25
I am wanting to integrate a custom dll into my Visual Basic 6
and the steps given are
(1)Add MRTLib.h and MRTLib.dll to a project.
(2)Implement LoadLibrary() Win32 API function to load “MRTLib.dll”
(3)Following (2), get function pointer address for each function of the DLL with GetProcAddress() API.
(3) Implement your program code.
(4) Build and debug.
Im stuck at the first step
Im not able to add project->reference to MRTLib.dll since visual studio says "can't add a reference to the specific file"
But if I add these lines the visual basic project compiled
Private Declare Function MRT_Init _
Lib "C:\MRTlib.dll" _
(ByVal hwnd As Long, _
ByVal messageoffset As Integer _
) As String
But Im not sure whether it is OK since Im not including either the .lib or the .h files ?
HOw to proceed to steps 2 ) and step 3) above
also in the usage document they have said
/* You have to prepare to reserve window message id for the DLL for your program, */
/* and assign the DLL with MRT_Init() API. */
status = MRT_Init(hInstDLL, DLL_MESSAGE_OFFSET); // formulaic procedure.
HWND hWnd, // [in] Handle to window waiting a message.
UINT messageOffset // [in] Offset value of message ID.
[in] An window handle receive the message.
[in] Specify the message ID which is the head value of range used by this library (DLL).
so what should I pass from visual basic to the MRT_init function for hWnd and messageOffset ?
What is reserving window message ?
What is Message offset ?
also I have a query about how to retrieve the returned value from functions of this dlls
The document says for example
3) Return Values for the MRT_init function is
MRT_NORMAL: This function succeeds.
i.e how do I find using visual basic whether the MRT_STATUS is MRT_NORMAL ??