I have a C# sytem tray application which is minimized in the system tray when the user closes the form by using the following code:
private void TrayForm_FormClosing(object sender, FormClosingEventArgs e)
{
Hide();
e.Cancel = true;
}
It works great except the computer does not shut down because the system tray application keep hidding instead of closing itself.
Is there a way to close the form in case when the Windows is shutting down?