hWnd
Pointer to the engine window.
LC
Type:
HWND
Remarks:
- This variable can be used for accessing the engine window, or set to a different window (together with hWndTarget). In the latter case all window functions (such as video_set) then affect the new window. Additionally, the engine message loop (on_message) should be called by the target window's message loop for catching keyboard input.
- For rendering into a target window, use the hWndTarget variable.
-
This variable is only valid after the engine window is opened in the first frame. So one wait() command is necessary in the main function before hWnd can be accessed.
Example:
// use Windows API functions for adding a menu to the engine window
function main()
{
...
wait(1); // wait until hWnd is valid
long hMenu = CreateMenu();
long hSubMenu = CreateMenu();
InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,1,"Function1");
InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"Function2");
InsertMenu(hMenu,0,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu,"Submenu");
SetMenu(hWnd,hMenu);
...
See also:
hWndTarget, on_message
► latest
version online