Aracılığıyla paylaş


Nasıl Yapılır: Uygulama Çıkış Kodunu Alma ve Ayarlama

This example shows how to get and set the application exit code.

Örnek

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.

The default exit code value that is returned by Application is 0. You can get the exit code value by handling Exit and inspecting the ApplicationExitCode property:

            Dim exitCode As Integer = e.ApplicationExitCode
int exitCode = e.ApplicationExitCode;

You can change the exit code value from the default by setting ApplicationExitCode, or by calling Shutdown:

            e.ApplicationExitCode = 11
e.ApplicationExitCode = 11;
            Application.Current.Shutdown(11)
Application.Current.Shutdown(11);