Modify

Opened 12 years ago

Closed 12 years ago

#2818 closed Feature Request (Rejected)

OnAutoItExitRegister - Remarks and Example - proposal

Reported by: mLipok Owned by:
Milestone: Component: Documentation
Version: Severity: None
Keywords: Cc:

Description

Please consider supplementing Remark for information regarding the use of the function in which the parameters are used. This can cause error messages 'Variable used without Declaring'

In addition, I attach example workaround. Please consider placing it in HelpFile.

#include <MsgBoxConstants.au3>

OnAutoItExitRegister(MyExitFunc)
OnAutoItExitRegister(ExitWrapper)

; first normal function call - to check if Local is defined
MyExitFunc()

Sleep(1000)

; last function call - 'OnExit'
; Remark first be caled ExitWrapper
Exit

Func MyExitFunc($vTest = -1)
	Local Static $iCount = 1
	MsgBox($MB_SYSTEMMODAL, "Exit test #" & $iCount, "IsDeclared('vTest') " & @CRLF & IsDeclared('vTest'))
	$iCount += 1
EndFunc   ;==>MyExitFunc

Func ExitWrapper()
	MsgBox($MB_SYSTEMMODAL, '', 'Now exiting using ExitWrapper()')

	MyExitFunc()
EndFunc

Attachments (1)

OnAutoItExitRegister[2].au3 (591 bytes ) - added by mLipok 12 years ago.

Download all attachments as: .zip

Change History (3)

by mLipok, 12 years ago

Attachment: OnAutoItExitRegister[2].au3 added

comment:1 by Melba23, 12 years ago

OnAutoItExitRegister is designed as a "one-stop" call for UDFs that need to clear up after they are used. If a user wants to have several dependent OnExit functions, then they should arrange them in a single wrapper function which is then passed for action on AutoIt exit. The problem is for the user to resolve, not AutoIt.

M23

comment:2 by Melba23, 12 years ago

Resolution: Rejected
Status: newclosed

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.