DLL and HWND

Previous topic - Next topic

Gary

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

Gary

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

Schranz0r

Why void* and not HWND* ?
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Gary

Didn't know HWND* existed that's why :)