Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
%IDC_Expand = 500
Global hDlg As Dword, oldw,oldh,oldx,oldy As Long, BigDialog As Long
Function PBMain() As Long
Dialog New Pixels, 0, "Big Screen",400,400,200,200, %WS_OverlappedWindow To hDlg
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local w,h,style As Long
Select Case Cb.Msg
Case %WM_InitDialog
BuildAcceleratorTable
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Expand
BigDialog = BigDialog Xor 1
If BigDialog Then
Style = GetWindowLong(hDlg, %GWL_style)
Style = (Style And Not %WS_OverlappedWindow) Or %WS_Popup
SetWindowLong hDlg, %GWL_Style, Style
Dialog Get Size hDlg To oldw,oldh 'save the old w/h size of the dialog
Dialog Get Loc hDlg To oldx,oldy 'save the old w/h size of the dialog
Desktop Get Size To w,h
Dialog Set Loc hDlg, 0,0
Dialog Set Size hDlg, w,h
SetWindowPos(hDlg, %HWND_TopMost, 0, 0, 0, 0, %SWP_NoMove Or %SWP_NoSize) 'on Top
Else
Style = GetWindowLong(hDlg, %GWL_style)
Style = (Style And Not %WS_Popup) Or %WS_OverlappedWindow
SetWindowLong hDlg, %GWL_Style, Style
Dialog Set Loc hDlg, oldx,oldy
Dialog Set Size hDlg, oldw,oldh
SetWindowPos(hDlg, %HWND_NoTopMost, 0, 0, 0, 0, %SWP_NoMove Or %SWP_NoSize) 'on Top
End If
End Select
End Select
End Function
Sub BuildAcceleratorTable
Local c As Long, ac() As ACCELAPI, hAccelerator As Dword
Dim ac(0)
ac(c).fvirt = %FVIRTKEY : ac(c).key = %VK_F12 : ac(c).cmd = %IDC_Expand
Accel Attach hDlg, AC() To hAccelerator
End Sub
'gbs_00722
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm