I want to my application can prevent from windows shutting down. I know that there is a system command to do that. But don't work for my program.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason.Equals(CloseReason.WindowsShutDown))
{
MessageBox.Show("Cancelling Windows shutdown");
string cmd = "shutdown /a";
Process.Start(cmd);// for executing system command.
}
}