Maximize ?

BlitzMax Forums/BlitzMax Programming/Maximize ?

Twinprogrammer(Posted 2012) [#1]
Hello,
I was wondering, is there a True or False function for telling you if a Program is Maximized or Minimized for windows?

Twinprogrammer


therevills(Posted 2012) [#2]
Try this code:

SuperStrict
Graphics 800, 600

?Win32
Extern "win32"
        Function IsZoomed%(hWnd%) = "IsZoomed@4"
        Function GetActiveWindow%()
End Extern

EnableMaximize(GetActiveWindow())

Function EnableMaximize(hWnd:Long)
	?Win32
	Local tmp:Int = GetWindowLongA( hWnd, GWL_STYLE )
	tmp = tmp | WS_MAXIMIZEBOX
	SetWindowLongA( hWnd, GWL_STYLE, tmp )
	DrawMenuBar( hWnd )
	?
End Function
?

Local paused% = False
Local maximised% = False

Repeat
	Cls
	
	While PeekEvent()

		PollEvent()
	
		Select EventID()
			Case EVENT_APPSUSPEND
				Print "APPSUSPEND"
				paused = True
			Case EVENT_APPRESUME
				Print "APPRESUME"
				paused = False
			Case EVENT_APPTERMINATE
				Print "APPTERMINATE"
				End
		End Select
		?win32
		If isZoomed(getActiveWindow())
			Print "isZoomed!"
			maximised = True
		Else
			maximised = False
		EndIf
		?
	Wend
	
	If paused Then
		DrawText "PAUSED", 10 , 10
	Else

		For Local i% = 0 To 100
			Plot Rnd(800), Rnd(600)
		Next
	EndIf
	If maximised Then
		DrawText "MAXIMISED", 10 , 40
	Else
		DrawText "NOT MAXIMISED", 10 , 40
	EndIf
	
	Flip
Until 0 = 1 ' forever :P


Only works for Windows though...


Grisu(Posted 2012) [#3]
You can also use the command WindowMinimized()
	Select EventID()
	Case EVENT_AppSuspend 
		If WindowMinimized(Mainwindow) Then
        ....



therevills(Posted 2012) [#4]
WindowMinimized


I thought that was only for MaxGUI...


jsp(Posted 2012) [#5]
Yes, only for MaxGui!

If WindowMinimized(Mainwindow) Then

The Mainwindow has to be of TGadget Type.