// Hibernate
Application.SetSuspendState(PowerState.Hibernate, true, true);
// Standby
Application.SetSuspendState(PowerState.Suspend, true, true);
或者,如果您喜欢系统调用:
[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);