Hi,
I have an application and this application needs to close when the window shutdown happen. How can i detect that the system is shutting down from a C# program
Printable View
Hi,
I have an application and this application needs to close when the window shutdown happen. How can i detect that the system is shutting down from a C# program
if it is a windows application, use the FormClosing event
Code:private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
if (e.CloseReason == CloseReason.WindowsShutDown) {
//
}
}
Subscribe to the event System.Events.SessionEnded.