Sign in to follow this  
Followers 0
Glyph

How to cancel an exit?

4 posts in this topic

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



the X of the message box or of the GUI?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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  
Followers 0