Minimize/Maximize Programatically

Category: Apps/Dialogs

Date: 07-23-2010

Return to Index


 
'Style values can be used to set the Min/Max state of a dialog.
 
'Primary Code:
'PowerBASIC DDT commands are available to perform the action
Dialog Show State hDlg, %SW_Minimize
Dialog Show State hDlg, %SW_Maximize
Dialog Show State hDlg, %SW_Restore
 
'Compilable Example:
#Compile Exe
#Dim All
Global hDlg As DWord
Function PBMain() As Long
  Dialog New Pixels, 0, "Min/Max Test",300,300,200,200, _
                                  %WS_SysMenu, 0 To hDlg
  Control Add Button, hDlg, 100,"Minimize", 50,50,100,20
  Control Add Button, hDlg, 101,"Maximize", 50,100,100,20
  Control Add Button, hDlg, 102,"Restore", 50,150,100,20
  Dialog Show Modal hDlg Call DlgProc
End Function
 
CallBack Function DlgProc() As Long
   Select Case CB.Msg
      Case %WM_Command
         If CB.Ctl = 100 AND CB.Ctlmsg = %BN_Clicked Then Dialog Show State hDlg, %SW_Minimize
         If CB.Ctl = 101 AND CB.Ctlmsg = %BN_Clicked Then Dialog Show State hDlg, %SW_Maximize
         If CB.Ctl = 102 AND CB.Ctlmsg = %BN_Clicked Then Dialog Show State hDlg, %SW_Restore
   End Select
End Function
 
'gbs_00048


created by gbSnippets: http://www.garybeene.com