Ticket #2818: OnAutoItExitRegister[2].au3

File OnAutoItExitRegister[2].au3, 591 bytes (added by mLipok, 6 years ago)
Line 
1#include <MsgBoxConstants.au3>
2
3OnAutoItExitRegister(MyExitFunc)
4OnAutoItExitRegister(ExitWrapper)
5
6; first normal function call - to check if Local is defined
7MyExitFunc()
8
9Sleep(1000)
10
11; last function call - 'OnExit'
12; Remark first be caled ExitWrapper
13Exit
14
15Func MyExitFunc($vTest = -1)
16        Local Static $iCount = 1
17        MsgBox($MB_SYSTEMMODAL, "Exit test #" & $iCount, "IsDeclared('vTest') " & @CRLF & IsDeclared('vTest'))
18        $iCount += 1
19EndFunc   ;==>MyExitFunc
20
21Func ExitWrapper()
22        MsgBox($MB_SYSTEMMODAL, '', 'Now exiting using ExitWrapper()')
23
24        MyExitFunc()
25EndFunc