Date: 02-16-2022
Return to Index
created by gbSnippets
'Determines if a windows is maximized. Often used to decide what action to take,
'such as NOT saving dimensions when a program is closed while in maximized state,
'or not positioning a popup outside the dialog.
'Primary Code:
iResult& = IsZoomed(hDlg)
'Compilable Example: (Jose Includes)
'In this example, the textbox IS NOT resized if the dialog has been maximized.
'This prevents the %WM_Size code from setting invalid dimensions, such (in this example,
'the w/h of the dialog would be set to -20 if IsIconic were not applied).
'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",600,400,300,300, %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
Local Answer$, x As Long, y As Long
Select Case CB.Msg
Case %WM_Command
If CB.Msg = %WM_Command AND CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then
Dialog Get Loc hDlg To x,y
If IsZoomed(hDlg) = %False Then
'this code puts the InputBox$ outside the dialog so it won't hide the dialog content
Answer$ = InputBox$("Please enter your name.", "Name Entry", "Gary Beene", x-350, y-200)
Else
'this code centers the InputBox$ inside the dialog. since the dialog is maximized the InputBox$
'would not be visible if placed outside the dialog.
Answer$ = InputBox$("Please enter your name.", "Name Entry", "Gary Beene")
End If
End If
End Select
End Function
'gbs_00027
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm