[ACCEPTED]-C# put pc to sleep or hibernate-sleep
Accepted answer
// Hibernate
Application.SetSuspendState(PowerState.Hibernate, true, true);
// Standby
Application.SetSuspendState(PowerState.Suspend, true, true);
Or, if you like system calls:
[DllImport("Powrprof.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent);
// Hibernate
SetSuspendState(true, true, true);
// Standby
SetSuspendState(false, true, true);
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.