AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Disabling the power key

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ManaUser



Joined: 24 May 2007
Posts: 1121

PostPosted: Sat Aug 08, 2009 9:00 pm    Post subject: Disabling the power key Reply with quote

I'm sure there have been threads on this before, but I couldn't find one just now, so oh well. Has anyone found a way to disable (or repurpose) the power-off key on a keyboard without interfering with the main power button on the case?

I just got a keyboard that has power management buttons in the dumbest place possible (right above the arrow keys), I know it's only a matter of of time before they bite my in the a$$.
Back to top
View user's profile Send private message
lilalurl.T32



Joined: 17 May 2007
Posts: 391
Location: Titan

PostPosted: Sun Aug 09, 2009 9:10 pm    Post subject: Reply with quote

Have you tried with AHKHID?
http://www.autohotkey.com/forum/viewtopic.php?t=41397

I think it intercepts the key strokes so hopefully it will not trigger the shutdown command when you try and see its event code.


Otherwise, is it an exotic keyboard or a branded keyboard (Logitech, MS etc...)? You can usually find online some registry settings to modify to change thebehaviour of this kind of keys.


You might not like the idea, but if it fails and you can't find another solution, you still have the option to physically remove the key (either by forcing it out or after unscrewing the keyboard). Just place some sellotape above the hole once it is done.
________
FAMILY GUY FORUM


Last edited by lilalurl.T32 on Sun Mar 13, 2011 6:44 am; edited 1 time in total
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 1121

PostPosted: Sun Aug 09, 2009 11:02 pm    Post subject: Reply with quote

HID is only for USB, devices, isn't it? This keyboard is PS2. Or am I wrong about that? The dismemberment option had occurred to me and it's an El Cheapo keyboard, so I don't mind too much, but obviously it's not ideal. I wasn't aware there might be a registry hack, so thanks for that idea, I'll look into it.
Back to top
View user's profile Send private message
lilalurl.T32



Joined: 17 May 2007
Posts: 391
Location: Titan

PostPosted: Sun Aug 09, 2009 11:15 pm    Post subject: Reply with quote

Yes, apparently PS/2 does not support HID protocol.

Have you tried keytweak?
http://webpages.charter.net/krumsick/

It seems to support some power management buttons and to work with PS/2 keyboards.

This page lists other programs/potential solutions to which you might want to give a try if keytweak does not work:
http://vlaurie.com/computers2/Articles/remap-keyboard.htm


Edit: By the way, why don't you contact El Cheapo support service?
http://www.elcheapo.ca/
http://www.elcheapo.co.nz/
Wink
________
Honda PC50 specifications


Last edited by lilalurl.T32 on Sun Mar 13, 2011 6:44 am; edited 1 time in total
Back to top
View user's profile Send private message
Hezzu



Joined: 08 Aug 2008
Posts: 117
Location: Raahe, Finland

PostPosted: Mon Aug 10, 2009 1:05 am    Post subject: Reply with quote

Dude, I feel your pain

for the past 3 keyboards i've had (10 years) i've had 2 with a HUGE power off/sleep buttons and on the second keyboard the button was on the way, so that when I grabbed the keyboard I accidentally hit the button.

now it is not on the way but still it is indimitatingly HUGE I mean other buttons are like half an inch but this is inch wide.

I just wanna choke the engineer that made the god forsaken button! Evil or Very Mad
_________________
Hezzu - excuse the english!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Mon Aug 10, 2009 1:10 am    Post subject: Reply with quote

if u never use it and not planning to use it, well as suggested
just kill it
taking the button out is a little bit ugly, so take out the button and "cut" the connect part to make it shorter, so it wont touch even u press that mf key
Back to top
ManaUser



Joined: 24 May 2007
Posts: 1121

PostPosted: Mon Aug 10, 2009 8:12 am    Post subject: Reply with quote

The problem is, when I try to remap the key, AutoHotkey can detect it, and do something, but Windows still "sees" too. I had hopes for that KeyTweak program you suggested, since it modifies the registry, but it had the same result anyway.

I'll check out some of those other links, but I don't really expect anything different. It seems these keys are handled at a low level that is very difficult to block, kind of like Win+L I guess.

Thanks for all the advice though.

lilalurl.T32 wrote:
Edit: By the way, why don't you contact El Cheapo support service?
http://www.elcheapo.ca/
http://www.elcheapo.co.nz/ Wink

Razz Okay, it isn't really, El Cheapo brand. It's actually GE, of all things, but it was the cheapest one in the store.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Mon Aug 10, 2009 8:46 am    Post subject: Reply with quote

ManaUser wrote:
It seems these keys are handled at a low level that is very difficult to block, kind of like Win+L I guess.


If you cannot block the key, you could try cancelling the Shutdown atleast.
My KB does not have a Power button so I am simulating it with a Hotkey.

Code:
#SingleInstance, Force
DllCall( "kernel32.dll\SetProcessShutdownParameters", UInt, 0x4FF, UInt, 0 )
OnMessage(0x11, "WM_QUERYENDSESSION")
Return

^F12:: ; Replace ^F12 with Scancode of Power Button
PowerButton := True
ShutDown, 8 ; Remove this line
Return

WM_QUERYENDSESSION() {
 Global PowerButton
 IfEqual,PowerButton,1, Return, ( PowerButton := False )
 Else Return True
}


Adapt the above code by changing the lines in Red
Back to top
View user's profile Send private message Send e-mail
ManaUser



Joined: 24 May 2007
Posts: 1121

PostPosted: Mon Aug 10, 2009 3:46 pm    Post subject: Reply with quote

Hey not bad! It makes the active window lose focus for some reason, but that should be fairly easy to deal with.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group