[ACCEPTED]-C# put pc to sleep or hibernate-sleep

Accepted answer
Score: 60
// 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

More Related questions