View Full Version: Gamemaker & Dlls

C++ Learning Community > Other Programing Languages > Gamemaker & Dlls


Title: Gamemaker & Dlls
Description: window question


Gmakermaniac!!! - December 12, 2004 11:07 PM (GMT)
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?

InfoProducts - December 18, 2004 03:35 PM (GMT)
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;
};

Gmakermaniac!!! - December 23, 2004 02:36 AM (GMT)
Dose that include sending a message (like WM_CLOSE)? I tried, but to no avail.

InfoProducts - January 1, 2005 10:47 AM (GMT)
u can use any function where the handle of window is required.

Gmakermaniac!!! - January 3, 2005 12:16 AM (GMT)
yeah, now that I think of it, the message loop has to be somewhere in a delphi program too




* Hosted for free by InvisionFree