###Keyword###
Func OnAutoItExit ()...EndFunc

###Description###
Defines a user-defined function that will be called when the script exit.

###Syntax###
<b>Func OnAutoItExit ( )</b>
	...
<b>EndFunc</b>


###Parameters###
None.


###Remarks###
Inside the function, @ExitCode can be used to retrieve the code set by the exit statement.

The mode of exit can be retrieved with @ExitMethod.
@@ParamTable@@
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.
@@End@@


###Related###
<a href="FuncOnAutoItStart.htm">Func OnAutoItStart ()</a>, <a href="..\functions\AutoItSetOption.htm#OnExitFunc">OnExitFunc (Option)</a>


###Example###
@@IncludeExample@@
