Modify

Opened 16 years ago

Closed 16 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 by Valik, 16 years ago

Resolution: Rejected
Status: newclosed

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).

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.