I thought that is impossible to put your PC in sleep or hibernate via C#. I found that is incorrect! Moreover, that is very simple too, just one line of command.
Putting the PC in sleep mode
Code:
Application.SetSuspendState(PowerState.Suspend, false, false); |
Putting the PC in Hibernate mode
Code:
Application.SetSuspendState(PowerState.Hibernate, false, false); |
That is so simple!!!
Recent comments