Je souhaite mettre mon système en veille ou en veille prolongée, deux options différentes.
Comment pourrais-je faire cela avec les API, je ne veux pas vraiment utiliser Process et cela ne me permet pas de choisir la méthode que je veux pour cette action.
// Hibernate Application.SetSuspendState(PowerState.Hibernate, true, true); // Standby Application.SetSuspendState(PowerState.Suspend, true, true);
Ou, si vous aimez les appels système:
[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);