Maximise Button (again) [MAXGUI]+[NON]

BlitzMax Forums/BlitzMax Beginners Area/Maximise Button (again) [MAXGUI]+[NON]

This example should make a 800x600 window with min,max,close buttons that cannot be resized.

Graphics 800,600,0

Extern "win32"
	Function GetActiveWindow()
	Function GetWindowLongA(hWnd%, nIndex%) = "GetWindowLongA@8"
	Function SetWindowLongA(hWnd%, nIndex%, uFlags%) = "SetWindowLongA@12"
	Function DrawMenuBar%(hMenu%)
End Extern

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

' example
Local handle:Long = GetActiveWindow()
fixWindow( handle )

Repeat
  Cls 
  SetColor 255,255,255
  DrawText "Window with minimize, maximize and close button.", 20,20
  DrawText "that cannot be resized.", 20,40
  Flip 
Until KeyHit(KEY_ESCAPE) Or AppTerminate()

Function fixWindow( hWnd:Long )
	Local tmp:Int = GetWindowLongA( hWnd, GWL_STYLE )
	tmp = tmp | WS_MAXIMIZEBOX
	tmp = tmp | WS_MINIMIZEBOX
	SetWindowLongA( hWnd, GWL_STYLE, tmp )
	DrawMenuBar( hWnd )
End Function