ExitCode Property (AApp) |
Version 9 |
Returns or sets the current process exit code.
Object.ExitCode [ = lExitCode]
The ExitCode property syntax has the following parts:
Name |
Type |
Description |
Object |
AApp |
AApp object |
lExitCode |
Long |
Process exit code. Default is 0. |
Exit code is used as a process return value. 0 usually signals normal exit/no error while negative numbers will normally signal an error.
Applications can use the Windows API GetExitCodeProcess to determine a process exit code:
hProcess=WinExec("c:\\MyProcess.exe")
WaitForSingleObject(hProcess)
GetExitCodeProcess(hProcess, lExitCode)
print lExitCode
In batch files (cmd.exe) you can use the ERRORLEVEL variable to determine the last process exit code.
The following statement set the current process exit code to -3 and exit the application:
app.ExitCode=-3
exit