GLBasic forum

Main forum => GLBasic - en => Topic started by: Gary on 2015-Aug-28

Title: DLL and HWND
Post by: Gary on 2015-Aug-28
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

Code (glbasic) Select

BP_StartDLL = (bp_bool_hwnd) GetProcAddress (DllModule, "BP_StartDLL");


and it says to call it you need to do the following

Code (glbasic) Select
RetVal = (*BP_StartDLL)(myhWnd);

Now I thought I had found out how to do it from the help and set things up like this

Code (glbasic) Select
DECLARE_ALIAS(BPStartDLL, "gamesocket.dll", "BP_StartDLL", (bool hwnd), int);

in the part where I load the DLL and declare all the functions

and

Code (glbasic) Select
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
Title: Re: DLL and HWND
Post by: Gary on 2015-Sep-01
Solved it, Will post my solution incase anyone else needs to do something similar

I used

Code (glbasic) Select
DECLARE_ALIAS(BPStartDLL, "gamesocket.dll", "BP_StartDLL", (void*), int);

to set up the call and

Code (glbasic) Select
FUNCTION StartDLL:
INLINE

if(BPStartDLL)
return BPStartDLL(GLBASIC_HWND());
else
return 255;
ENDINLINE
ENDFUNCTION


to send the HWND value
Title: Re: DLL and HWND
Post by: Schranz0r on 2015-Sep-07
Why void* and not HWND* ?
Title: Re: DLL and HWND
Post by: Gary on 2015-Sep-10
Didn't know HWND* existed that's why :)