Howto: MaxGUI minimize without resize

BlitzMax Forums/MaxGUI Module/Howto: MaxGUI minimize without resize

Eikon(Posted 2005) [#1]
Howto: Create a GUI window that is minimizable but not resizable

Here's my code for future reference, this is a commonly requested thing
Extern "win32"
	Function GetWindowLong(hwnd, nIndex) = "GetWindowLongA@8"
	Function SetWindowLong(hwnd, index, nIndex) = "SetWindowLongA@12"
End Extern

Local Window:TGadget = CreateWindow("Testing", 10, 10, 512, 512, 0, WINDOW_TITLEBAR)

hWnd = Query(Window, 1)
ret = GetWindowLong(hWnd, -16)
ret = ret | $20000
SetWindowLong hWnd, -16, ret

UpdateWindowMenu Window

Repeat
	WaitEvent()
Until EventID() = EVENT_WINDOWCLOSE



Chris C(Posted 2005) [#2]
neat!


AndreasV(Posted 2008) [#3]
Just a little correction: Query() has been replaced with QueryGadget() since Version 1.4, so the correct code since then is:
Extern "win32"
	Function GetWindowLong(hwnd, nIndex) = "GetWindowLongA@8"
	Function SetWindowLong(hwnd, index, nIndex) = "SetWindowLongA@12"
End Extern

Local Window:TGadget = CreateWindow("Testing", 10, 10, 512, 512, 0, WINDOW_TITLEBAR)

hWnd = QueryGadget(Window, 1)
ret = GetWindowLong(hWnd, -16)
ret = ret | $20000
SetWindowLong hWnd, -16, ret

UpdateWindowMenu Window

Repeat
	WaitEvent()
Until EventID() = EVENT_WINDOWCLOSE




plash(Posted 2008) [#4]
From tutorials->maxgui->module tweaks?

This is no module tweak, this belongs in maxgui discussion..


SebHoll(Posted 2008) [#5]
I know its not a *module* tweak, but it's certainly not standard MaxGUI behaviour. OK, I'll move it back to GUI Programming for now.