Have you ever wondered how do I create a GUI like the one shown below?! Then look no further with these Examples. I was playing around with $WS_DLGFRAME and figured that if I BitOR'd it with $WS_SIZEBOX it would create a GUI without the minimize and maximize, but what if I didn't want the re-sizing? After some playing around I realised that replacing $WS_SIZEBOX with $WS_SYSMENU would accomplish this instead of using WM_COMMAND to intercept SC_SIZE from the GUI. Then ?do=embed' frameborder='0' data-embedContent> pointed out it could be done via a different approach, so I updated using his way Examples below are for both re-sizing and non re-sizing as well as 2 Examples that don't appear in the TaskBar, this is due to using the hidden window [AutoItWinGetTitle()] as the parent handle. Any suggestions, then please post below. Thanks. Examples: #include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example1() ; Without Re-Sizing.
Example2() ; With Re-Sizing.
Example3() ; Without Re-Sizing & No TaskBar.
Example4() ; With Re-Sizing & No TaskBar.
Func Example1() ; Without Re-Sizing.
Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example1
Func Example2() ; With Re-Sizing.
Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX))
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example2
Func Example3() ; Without Re-Sizing & No TaskBar.
Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX), -1, WinGetHandle(AutoItWinGetTitle()))
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example3
Func Example4() ; With Re-Sizing & No TaskBar.
Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX), -1, WinGetHandle(AutoItWinGetTitle()))
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example4Old way I was doing it: #include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Example5() ; Old Way Of Doing It!
Func Example5() ; Old Way Of Doing It!
Local $hGUI = GUICreate('GUI With Only Close', 250, 250, -1, -1, BitOR($WS_SIZEBOX, $WS_DLGFRAME))
GUIRegisterMsg($WM_SYSCOMMAND, 'WM_SYSCOMMAND')
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGUI)
EndFunc ;==>Example5
Func WM_SYSCOMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $ilParam
Local Const $SC_MAXIMIZE = 0xF030, $SC_MINIMIZE = 0xF020, $SC_RESTORE = 0xF120, $SC_SIZE = 0xF000 ; $SC_MOVE = 0xF010
Switch BitAND($iwParam, 0xFFF0)
Case $SC_MAXIMIZE, $SC_MINIMIZE, $SC_RESTORE, $SC_SIZE
Return -1
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SYSCOMMAND ?do=embed' frameborder='0' data-embedContent>