Autohotkey_L 1.1.07.03 (Unicode 64-bit)
Hybrid sleep is off (http://maximumpcguid...p-in-windows-7/)
Hibernation is off (powercfg -h off)
Pagefile is off, RAM 4GB
When I select Sleep item from windows start menu, computer switches to standby in 2 seconds.
If SetSuspendState is invoked from autohotkey it takes 8-10 seconds
#Esc:: DllCall("PowrProf\SetSuspendState", "Char", 0, "Char", 1, "Char", 0) returnI've written simple C++ app that invokes SetSuspendState. It takes 2 seconds as Sleep item in start menu does.
#include <Windows.h> #include <PowrProf.h> #pragma comment(lib, "PowrProf.lib") int main() { SetSuspendState(FALSE, TRUE, FALSE); return 0; }So, seems problem is inside autohotkey.
PS
There is a mistake in example section of http://www.autohotke...ds/Shutdown.htm. Statement DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0) is wrong. SetSuspendState declaration:
typedef unsigned char BYTE; typedef BYTE BOOLEAN; BOOLEAN WINAPI SetSuspendState(BOOLEAN Hibernate, BOOLEAN ForceCritical, BOOLEAN DisableWakeEvent);So, proper variant is: DllCall("PowrProf\SetSuspendState", "Char", 0, "Char", 0, "Char", 0)