Code archives/BlitzPlus Gui/Minimize/Maximize Buttons

This code has been declared by its author to be Public Domain code.

Download source code

Minimize/Maximize Buttons by pantsonhead.com2004
This code is handy if you have a non-resizable window that you want to minimize.

Note: This will not work if you include a statusbar in the window style.

Requires User32.dll decls
.lib "user32.dll" 
GetWindowLong% (hwnd%, nIndex%) : "GetWindowLongA"
SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
Global winMain = CreateWindow("Main Window",100,100,200,200,0,1)

; Here's the magic bit :)
hWND=QueryObject(winMain,1)
x = GetWindowLong(hWnd, -16)
x = x Or $20000   ;WS_MINIMIZEBOX - add Minimize button
;x = x Or $10000   ;WS_MAXIMIZEBOX - add Maximize button
SetWindowLong (hWnd, -16, x)

;Refresh WindowMenu to see new buttons
UpdateWindowMenu winMain

Repeat
	If WaitEvent(1) =$803 Then
		End
	EndIf
Forever

Comments

None.

Code Archives Forum