 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
iamnu
Joined: 31 May 2007 Posts: 23
|
Posted: Mon Nov 16, 2009 3:14 pm Post subject: Hot Key Modifier Not Working |
|
|
#H::
{
; Call the Windows API function "SetSuspendState" to have the system suspend or hibernate.
; Windows 95/NT4: Since this function does not exist, the following call would have no effect.
; Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
; Parameter #2: Pass 1 instead of 0 to suspend immediately rather than asking each application for permission.
; Parameter #3: Pass 1 instead of 0 to disable all wake events.
DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
Return
}
If I change the Hotkey from #H:: to ^Numpad0:: then this code is not executed when I enter ctrl+0 on the numpad.
Can someone explain? |
|
| Back to top |
|
 |
Peter
Joined: 30 Dec 2005 Posts: 448
|
Posted: Mon Nov 16, 2009 3:43 pm Post subject: |
|
|
I can't really explain, because it works for me (including Hibernate).
But aren't there any modifier keys stuck (not physically but acting like they are down)?
Just a remark, you don't need the braces {}, only in Functions, if-else, etc.
Although it seems to work, code like this is the normal way:
| Code: | ^Numpad0::
msgbox test
DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
return |
|
|
| Back to top |
|
 |
iamnu
Joined: 31 May 2007 Posts: 23
|
Posted: Mon Nov 16, 2009 4:50 pm Post subject: |
|
|
Thanks for the reply.
I removed the braces, and my original Hotkey still works, but the new one still does not. No stuck keys either... |
|
| Back to top |
|
 |
Peter
Joined: 30 Dec 2005 Posts: 448
|
Posted: Tue Nov 17, 2009 2:34 am Post subject: |
|
|
Does it work with e.g. ^H hotkey?
Try script below, it should show the Ctrl and Numpad0 status. You can extend the script with other keys.
In case you have another keyboard, try with that one. If it's a hardware problem, then it could save you a lot of time. | Code: | Loop {
numpad0Key := GetKeyState("Numpad0", "P")
ctrlKey := GetKeyState("ctrl", "P")
tooltip ctrlKey= %ctrlKey% `nnumpad0Key= %numpad0Key%
Sleep 100
}
return
F9::ExitApp |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|