How to: Get and Set the Application Exit Code
This example shows how to get and set the application exit code.
Application automatically returns an exit code value to the operating system when the application stops running. Exit codes are most often used by applications to communicate the reason they stopped running to the operating system, or to other running applications.
You can change the exit code value from the default by setting ApplicationExitCode, or by calling Shutdown: