Jump to content
Sign in to follow this  

Prevent window being closed

Recommended Posts


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)
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")
While 1
Func Progress_Stop_Start()
If $status Then
     GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 0, 200)
     $status = 0
     GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 1, 200)
     $status = 1

Share this post

Link to post
Share on other sites
Emiel Wieldraaijer

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



$GUI = GUICreate("Progress", 400, 100, -1, -1, $flg)

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post

Link to post
Share on other sites

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.

RAID Calculator | Software Installer

The truth has been suppressed since the dawn of time.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.