Disable the Minimize button on a non-BMax Window?

BlitzMax Forums/BlitzMax Programming/Disable the Minimize button on a non-BMax Window?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Extern "win32"
	Function GetWindowLongA(hWnd:Long,nIndex:Int) = "GetWindowLongA@8"
	Function SetWindowLongA(hWnd:Long,nIndex:Int,uFlags:Int) = "SetWindowLongA@12"
	Function DrawMenuBar:Int(hMenu:Long)
End Extern

Const GWL_STYLE = (-16)
Const WS_MAXIMIZEBOX:Long = $10000
Const WS_MINIMIZEBOX:Long = $20000

Function disableMinimize(hwnd:Long)
	Local tmp:Long = GetWindowLongA( hwnd, GWL_STYLE )
	Local tmp2:Long = tmp And WS_MINIMIZEBOX
	tmp = tmp - tmp2
	SetWindowLongA( hwnd, GWL_STYLE, tmp )
	DrawMenuBar( hwnd )
End Function

Function enableMinimize(hwnd:Long)
	Local tmp:Long = GetWindowLongA( hwnd, GWL_STYLE )
	tmp = tmp | WS_MINIMIZEBOX
	SetWindowLongA( hwnd, GWL_STYLE, tmp )
	DrawMenuBar( hwnd )
End Function

Function disableMaximize(hwnd:Long)
	Local tmp:Long = GetWindowLongA( hwnd, GWL_STYLE )
	Local tmp2:Long = tmp And WS_MAXIMIZEBOX
	tmp = tmp - tmp2
	SetWindowLongA( hwnd, GWL_STYLE, tmp )
	DrawMenuBar( hwnd )
End Function

Function enableMaximize(hwnd:Long)
	Local tmp:Long = GetWindowLongA( hwnd, GWL_STYLE )
	tmp = tmp | WS_MAXIMIZEBOX
	SetWindowLongA( hwnd, GWL_STYLE, tmp )
	DrawMenuBar( hwnd )
End Function