Jump to content
Sign in to follow this  
Glyph

How to cancel an exit?

Recommended Posts

Glyph

Func OnAutoItExit()
    $verify=MsgBox(4,"Application","Are you sure you want to exit?")
    if $verify = 6 then Exit
    ;if $verify = 7 then ;cancel exit?
EndFunc   ;==>OnAutoItExit

After the person presses the "x" button I want it to ask before exiting.

If they say no to exit, then I want it to keep the application running.

Is this possible?


tolle indicium

Share this post


Link to post
Share on other sites
oMBRa

the X of the message box or of the GUI?

Share this post


Link to post
Share on other sites
Jos

This is not the right place to test for that.

You test this with the Event of GetMsg().

If $msg = $GUI_EVENT_CLOSE Then
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Glyph

This is not the right place to test for that.

You test this with the Event of GetMsg().

If $msg = $GUI_EVENT_CLOSE Then
woops, ahhaha!

thanks, heres what worked:

Case $msg = $GUI_EVENT_CLOSE
$verify = msgbox(4,"app","wanna exit?")
 if $verify = 6 then
exit
else
;do nothing
endif

tolle indicium

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.