I was making a DLL that changes the icon of a gamemaker game while the game is running. To do this I need the hwnd of the gamemaker window. I assume you can pass it into a DLL function as an argument by using the gml function window_handle() but I'm having a few problems. First of all, that's not a string or a real and I'm not sure what to set it to in Gamemaker (in the define_external() function). Second, Im not sure if window_handle() returns the handle to the correct window (mabey GM uses 2 or 3??). Can anyone explain how to get the window handle for a gamemaker game?
EDIT: also if I make a function do something like GetModuleHandle(NULL) in a DLL, dose it do it for the DLL, or for the window using the DLL?
i guess u r using cpp. set window handle arg type in gm to ty_real. and in ur cpp code take arg as double and do this.
HWND handle =(HWND)(DWORD)hand
where the hand is "double hand" in ur function. so handle is the window handle of gm, so u can do nething with it for ex
CloseWindow(handle)
| CODE |
int ClsWin(double hand) { HWND handle=(HWND)(DWORD)hand; CloseWindow(handle); return 0; };
|
Dose that include sending a message (like WM_CLOSE)? I tried, but to no avail.
u can use any function where the handle of window is required.
yeah, now that I think of it, the message loop has to be somewhere in a delphi program too