How to shutdown computers (windows) into hibernate state?

-1

I really enjoy one of the windows computer hibernate benefits:

I can power up the computer by pressing any key or mouse button.

I wish I can shutdown my computer into hibernate state. I mean, software OS is completely off, but hardware goes to hibernate level (I think it is S4). So I don't need to bend over to press the "hard-to-reach" power button on the PC case every time I want to turn on the computer.

Is there anyway programmly I can do that?

Already tried:

DllCall("ntdll.dll", "dword", "NtSetSystemPowerState", "dword", X, "dword", X, "ulong", 0x80000000)

Multiple power state values tested using the correct privilege, they either shutdown my pc or do-nothing. I can't programmly put my pc into S3 or S4 power state.

windows
hibernate
sleep-mode
asked on Stack Overflow Jun 14, 2020 by Kyle Chen

2 Answers

0
#include <stdlib.h>

int main()
{
    system("SHUTDOWN /H");
}

answered on Stack Overflow Jun 14, 2020 by user
0

SetSuspendState is the API to put the system into hibernate and well documented on MSDN.

answered on Stack Overflow Jan 4, 2021 by gabsleo

User contributions licensed under CC BY-SA 3.0