title: Preventing Windows from shutting down
body: <p>I am using windows form,I want to display the message to the user that the process is not complete if the user tries to shut down the windows or tries to closes the application before completion of process(the user forgot to complete the process),if the user presses OK i want to stop the window from shutting down and let the user complete the process,I did find some code on the net to do so but it is in VB not in c#</p>
  
  <pre><code>private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  {
      if (e.CloseReason.Equals(CloseReason.WindowsShutDown))
      {
          Microsoft.VisualBasic.Interaction.Shell("shutdown -a", AppWinStyle.MinimizedFocus, false, -1);
          MessageBox.Show("Shutdown process cancelled!");
      }
  }
  </code></pre>