amaru96 Posted June 29, 2012 Share Posted June 29, 2012 Hi guys, I use a progress bar popup when deploying applications to users machines but I want to prevent the window being closed. It's just an indicator letting the user know that the installation is still going and terminates once it's finished, however some users are closing the window and have no idea the app is still installing in the background. Any help would be appreciated. The code I'm using it below. #include <GUIConstants.au3> Global Const $PBS_MARQUEE = 0x08 Global Const $WM_USER = 0x0400 Global Const $PBM_SETMARQUEE = ($WM_USER+10) Global $status = 1 $labeltext = "Installing, please wait..." Opt("GUIOnEventMode", 1) $GUI = GUICreate("Progress", 400, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE") GUISetFont(10) ;sets the font size $Label = GUICtrlCreateLabel($labeltext, 10, 45, 330, 50) ;left, top, width, height $GUI_Progress = GUICtrlCreateProgress(10, 15, 380, 20, $PBS_MARQUEE) GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 1, 200) ;$GUI_Button = GUICtrlCreateButton("Start/Stop", 70, 50) GUICtrlSetOnEvent(-1, "Progress_Stop_Start") GUISetState() While 1 Sleep(100) WEnd Func Progress_Stop_Start() If $status Then GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 0, 200) $status = 0 Else GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 1, 200) $status = 1 EndIf EndFunc Func GUI_CLOSE() Exit EndFunc Link to comment Share on other sites More sharing options...
PlayHD Posted June 30, 2012 Share Posted June 30, 2012 (edited) when install is done set $status = 0Func GUI_CLOSE() If $status = 0 Then Exit EndFunc Edited June 30, 2012 by PlayHD My UDF : _WinShake, _WinSplitMy Apps : Google Guitar Bot, PuzzleGameDesign Gui : Interesting Tabs Design, RBox Project (abandoned), Animated Gui on Exit Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted June 30, 2012 Share Posted June 30, 2012 (edited) remove the X and add a button instead, the code below removes all. play a little with the parameters Disable the button and when finished Enable the button $flg = BitOR($GUI_SS_DEFAULT_GUI, $WS_DLGFRAME, $DS_MODALFRAME, $DS_SETFOREGROUND, $WS_CAPTION, $WS_SYSMENU, $WS_POPUP) $flg = BitAND($flg, Not $WS_MAXIMIZEBOX, Not $WS_MINIMIZEBOX) $GUI = GUICreate("Progress", 400, 100, -1, -1, $flg) Edited June 30, 2012 by Emiel Wieldraaijer Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
abberration Posted July 1, 2012 Share Posted July 1, 2012 When the progress bar starts, you can use GUISetState(@SW_DISABLE, $GUI) to disable the window and they will not be able to close it by clicking the red X in the top right corner. Then when the progress bar is 100%, can use GUISetState(@SW_ENABLE, $GUI) to bring the window back to life. Easy MP3 | Software Installer | Password Manager 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