Lock, Stand By, Hibernate and Log Off your System
using
System.Runtime.InteropServices;
public static extern void LockWorkStation();
//Locking the system
[DllImport("user32.dll")]public static extern void LockWorkStation();
LockWorkStation();
Application.SetSuspendState(PowerState.Suspend, true, true);
//Making system stand by and hibernation
Application.SetSuspendState(PowerState.Suspend, true, true);
Application.SetSuspendState(PowerState.Hibernate, true, true);
//Log off the user
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int uFlags, int dwReason);
public static extern int ExitWindowsEx(int uFlags, int dwReason);
ExitWindowsEx(0, 0);
Comments
Post a Comment