2
votes

An old problem, maybe (?) resolved for older Windows version, but not for Windows 10!

The solutions proposed in old discussions (... SetSuspendState with parameters 0,1,0 (or Sleep), with or without prior hibernate off ...) dont work on Windows 10 systems; at least not on all: the initiated mode is mostly hibernate, not sleep.

What I found out: In older Windows versions there was something like this in the Registry: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\sleep\command] @="rundll32.exe powrprof.dll,SetSuspendState Sleep" This obviously was the sleep command. At least on my Windows 10 PCs there is no such entry!

Somebody here with new answers?

================== EDITED: After this my OP I discovered that this is not a Windows 10 issue, it is a Surface 3 issue, related to the power option used on Surface 3 as Sleep mode:

The Sleep mode used by Surface 3 seems to be "Modern Standby" = "S0 Low Power Idle" = "Connected Network Standby". (Not the usual S3 Sleep mode!!!)

The commands using SetSuspendState seems to be unable at all to initiate the Sleep mode on a Surface 3.

A new wording for my question: All what I would like to have is a command which does the same as the Power button on a Surface 3 which is set to "power-button action = Sleep", or as the Sleep button on an external (USB) keyboard when Surface 3 is set to "sleep-button action = Sleep".

1
EDITED ... A new wording for my question: All what I would like to have is a command which does the same as the Power button on a Surface 3 which is set to "power-button action = Sleep", or as the Sleep button on an external (USB) keyboard when Surface 3 is set to "sleep-button action = Sleep". - newbieforever
Are you sure the power button / sleep button is actually putting the system in S3 and not "modern standby"? How do you tell the difference? - Harry Johnston
@Harry Johnston: ???The other way round!!! And I can know this because powercfg /a says that S3 isa not supported on Surface 3. - newbieforever
So you mean that you want to reach "modern standby" but SetSuspendState is resulting in hibernation aka S4? - Harry Johnston
A new attempt: (1) Primarily I would like to have a command which does the same as pressing the power button on each individual computer (i.e. the command does exactly the action which on the individual PC is set in Power Options as power-button action). (2) But forget this excessive question!!! (3) On my Surface 3 I set "Sleep" for the power-buttton and sleep-button action. (4) Surface 3 obviously uses "Modern Standby" in this case if I press the power or sleep button. (5) I simply would like to have a command which does the same on my Surface 3 as pressing the power or sleep button. - newbieforever

1 Answers

1
votes

I found this new solution on Programmatically enter Connected Standby in C#

On my Surface 3, I am able now to activate the Sleep mode ("Modern Standby" = "S0 Low Power Idle" = "Connected Network Standby") by a command which turns off the monitor. In Autohotkey this is simply the line:

SendMessage, 0x112, 0xF170, 2,, Program Manager

I can see in the sleepstudy-report.html (created by powercfg /sleepstudy) that really "Modern Standby" is entered by this.