Function Reference


OnAutoItExitRegister

Registers a function to be called when AutoIt exits.

OnAutoItExitRegister ( "function" )

Parameters

function The name of the user function to call.

Return Value

Success: Returns 1. @extended can be set if already registered.
Failure: Returns 0.

Remarks

The exit code can be retrieved with @ExitCode.
The mode of exit can be retrieved with @ExitMethod.
0 Natural closing.
1 close by Exit function.
2 close by clicking on exit of the systray.
3 close by user logoff.
4 close by Windows shutdown.

Related

OnAutoItExitUnRegister, Exit

Example


OnAutoItExitRegister("MyTestFunc")
OnAutoItExitRegister("MyTestFunc2")

Sleep(1000)

Func MyTestFunc()
    MsgBox(64, "Exit Results 1", 'Exit Message from MyTestFunc()')
EndFunc   ;==>MyTestFunc

Func MyTestFunc2()
    MsgBox(64, "Exit Results 2", 'Exit Message from MyTestFunc()')
EndFunc   ;==>MyTestFunc2