Date: 02-16-2022
Return to Index
created by gbSnippets
'IsIconic and IsZoom are the two API which test whether a dialog
'is minimized or maximized.
'Primary Code:
'Test for minimized
If IsIconic(hDlg) Then
... Is minimized
End If
'Test for maximized
If IsZoomed(hDlg) Then
... Is maximized
End If
'Test for restored (NOT minimized and NOT maximized)
If IsFalse(IsIconic(hDlg) Or IsZoomed(hDlg)) Then
... Is neither minimized nor maximized
End If
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Push", 50,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
If IsIconic(hDlg) Then
MsgBox "I'm minimized" 'you can't actually press the button when the dialog is minimized
ElseIf IsZoomed(hDlg) Then
MsgBox "I'm maximized"
Else
MsgBox "'m neither minimzed nor mazimized
End If
End If
End Function
'gbs_00062
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm