I have a DLL which I need to include in a program. I have got it all loading and opening properly but I am struggling with one of the commands I need to set up.
In the manual that came with the DLL is has visual studio examples and the one im struggling with at the moment is this one
BP_StartDLL = (bp_bool_hwnd) GetProcAddress (DllModule, "BP_StartDLL");
and it says to call it you need to do the following
RetVal = (*BP_StartDLL)(myhWnd);
Now I thought I had found out how to do it from the help and set things up like this
DECLARE_ALIAS(BPStartDLL, "gamesocket.dll", "BP_StartDLL", (bool hwnd), int);
in the part where I load the DLL and declare all the functions
and
FUNCTION StartDLL:
INLINE
if(BPStartDLL)
return BPStartDLL(GLBASIC_HWND);
else
return 255;
ENDINLINE
ENDFUNCTION
In the actual StartDLL function but it is refusing to talk to the other program it is supposed to. I think it is getting the wrong HWND value.
Anyone got any ideas where I am going wrong?
Thanks
Gary
Solved it, Will post my solution incase anyone else needs to do something similar
I used
DECLARE_ALIAS(BPStartDLL, "gamesocket.dll", "BP_StartDLL", (void*), int);
to set up the call and
FUNCTION StartDLL:
INLINE
if(BPStartDLL)
return BPStartDLL(GLBASIC_HWND());
else
return 255;
ENDINLINE
ENDFUNCTION
to send the HWND value
Why void* and not HWND* ?
Didn't know HWND* existed that's why :)