Modify

Opened 14 years ago

Closed 14 years ago

#1593 closed Feature Request (Rejected)

Prevent script Exit from OnAutoItExitRegister function

Reported by: MrCreatoR <mscreator@…> Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: OnAutoItExitRegister, exit, prevent Cc:

Description

It would be usefull if we could prevent the exit from script inside the function that called by OnAutoItExitRegister.

Example:

#include <GUIConstantsEx.au3>

OnAutoItExitRegister("_Exit")

$hGUI = GUICreate("Test Script", 300, 200)
GUISetState(@SW_SHOW, $hGUI)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch
WEnd

Func _Exit()
	Local $iAsk = MsgBox(51, 'Question', 'Save changes?' & @LF & @LF & 'Press [Cancel] button to prevent program Exit.', 0, $hGUI)
	
	Switch $iAsk
		Case 2 ;[Cancel] pressed
			Return 1 ;This should prevent the exit and return to the line where the Exit function was called (line #11)
		Case 6 ;[OK] pressed
			;_SaveSettings()
	EndSwitch
EndFunc

The function calling order is from last to the first if i am not wrong, so there should not be a problem with UDFs that might use OnAutoItExitRegister.

Attachments (0)

Change History (1)

comment:1 Changed 14 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to closed

This request does not make sense. If you do not wish for a script to exit then take control of the exit points (GUI events, tray events).

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.