Author Topic: DLL and HWND  (Read 1801 times)

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
DLL and HWND
« 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

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: DLL and HWND
« Reply #1 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

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5013
  • O Rly?
    • View Profile
Re: DLL and HWND
« Reply #2 on: 2015-Sep-07 »
Why void* and not HWND* ?
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline Gary

  • Dr. Type
  • ****
  • Posts: 313
    • View Profile
Re: DLL and HWND
« Reply #3 on: 2015-Sep-10 »
Didn't know HWND* existed that's why :)