Sp3ct3R
Sp3ct3R

Reputation: 725

Get all power options available

I have Windows 8 and the Power options are too hard to get to so i want to make a little app to replicate Power tab.

What i can't do is find a way to make windows Sleep. In windows 8 when the PC is Sleeping it is completely stopped and if you press a key it goes to Lock Screen instantaneously without the boot screen.

How can I accomplish that?

UPDATE: Or if it is possible to get a list of all power options available. ie: if hibernation is allowed...

I am using rundll32.exe powrprof.dll,SetSuspendState 0,1,0 to sleep PC now but it wakes very slow.

Upvotes: 0

Views: 550

Answers (2)

Răzvan Flavius Panda
Răzvan Flavius Panda

Reputation: 22106

This should help you.

I think you can lock the pc and then put it to sleep.

To lock the screen:

[DllImport("user32.dll", SetLastError = true)]
static extern bool LockWorkStation();

For entering sleep mode:

Application.SetSuspendState(PowerState.Suspend, false, false);

Upvotes: 2

paulsm4
paulsm4

Reputation: 121599

If you're using Win-RT, then you should use the "suspension manager":

Upvotes: 0

Related Questions