Vindicator209 Posted September 22, 2008 Share Posted September 22, 2008 How do I disable the minimize button on a gui? [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
SoulA Posted September 22, 2008 Share Posted September 22, 2008 (edited) In your case statement when you are deciphering what the user pressed you can set it up to just do nothing $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE EndSelect Edited September 22, 2008 by SoulA Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted September 22, 2008 Share Posted September 22, 2008 Perhaps.... #include <GUIConstants.au3> #include <WindowsConstants.au3> $iStyle1 = BitOr($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU); Style with minimize box $iStyle2 = BitOr($WS_MAXIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU); Style without minimize box $gui = GUICreate('', 200, 200, -1, -1, $iStyle1) $bt1 = GUICtrlCreateButton('Click me to enable', 5, 5, 120, 25) $bt2 = GUICtrlCreateButton('Click me to disable', 5, 35, 120, 25) GUISetState() While 1 $gm = GUIGetMsg() Switch $gm Case $GUI_EVENT_CLOSE ExitLoop Case $bt1 GUISetStyle($iStyle1) Case $bt2 GUISetStyle($iStyle2) EndSwitch WEnd .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Andreik Posted September 22, 2008 Share Posted September 22, 2008 Or you want do disable after a specified time you can use this code wrote by SmOke_N. expandcollapse popup#include <WinAPI.au3> $h_gui = GUICreate("Example GUI") GUISetState() $n_timer = TimerInit() While GUIGetMsg() <> -3 If $n_timer > 0 And TimerDiff($n_timer) / 1000 >= 3 Then _WinRemoveMinMaxBox($h_gui) $n_timer = 0 EndIf WEnd Func _WinRemoveMinMaxBox($h_wnd) Local Const $GWL__STYLE = -16 Local Const $WS__MAXIMIZEBOX = 0x0010000 Local Const $WS__MINIMIZEBOX = 0x0020000 If IsString($h_wnd) Then $h_wnd = WinGetHandle($h_wnd) Local $a_old_style = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $h_wnd, "int", $GWL__STYLE) If @error Then Return SetError(1, 0, 0) Local $i_style = 0 If BitAND($a_old_style[0], $WS__MAXIMIZEBOX) Then $i_style = BitOR($i_style, $WS__MAXIMIZEBOX) If BitAND($a_old_style[0], $WS__MINIMIZEBOX) Then $i_style = BitOR($i_style, $WS__MINIMIZEBOX) If Not $i_style Then Return $a_old_style[0] Local $a_set_window = DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $h_wnd, "int", $GWL__STYLE, "long", $a_old_style[0] - $i_style) If @error Then Return SetError(2, 0, 0) ; Cheap way to refresh the title bar WinSetTitle($h_wnd, "", WinGetTitle($h_wnd)) Return $a_set_window[0] EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now