Code: Select all
#Persistent
#UseHook On
#SingleInstance Force
#NoTrayIcon
; Suspend2Ram
~RButton & WheelUp::
{
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
return
}
; Hibernate
~RButton & WheelDown::
{
DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
return
}
I'm compiling this code with Ahk2Exe.exe and I'm calling this exe from task scheduler during logon.
The point is to hibernate / suspend2ram by right mouse button click and mouse wheel up/down, which works pretty well and I'm using this shortcut intensively almost year.
The problem is, when I wake up from suspend2ram or hibernate and I use the mouse wheel, so the pc is hibernated or suspended again, so after wake up I can't use the mouse wheel immediately.
To prevent this behavior I have to do right-click before ( few times ) and after this right-clicks is everything fine.
So if I use this shortcut to hibernate my pc and I wake up, the first thing which I have to do is mouse right-click, before I can use mouse wheel, if I I don't and I do some action with mouse wheel, my pc is hibernated immediately.
It looks like some info about right click is saved somewhere in autohotkey and after wake up it still looks, like this button is still pressed.
I hope I described it clearly, because this is really curious