نکته شماره 3 :

 

[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);
 
 
// Reboot
ExitWindowsEx(2, 0);
 
// Reboot
System.Diagnostics.Process.Start("ShutDown", "/r");
 
 
// Shutdown
ExitWindowsEx(1, 0);
 
 
// Shutdown
System.Diagnostics.Process.Start("ShutDown", "/s");
 
 
// Log Off
ExitWindowsEx(0, 0);
 
// Force LogOff
ExitWindowsEx(4, 0);
 
 
// Log Off
System.Diagnostics.Process.Start("ShutDown", "/l");