I don't know about AltGr, since I'm not familiar with it.
If there are more than one button then you are out of luck. But why would
AliR.
AliR (VC++ MVP) wrote (in news:yEU1k.3599$ZE5.1734@nlpi061.nbdc.sbc.com):
"Alec S." <@> wrote in message
news:O%23lM0axxIHA.1436@TK2MSFTNGP05.phx.gbl...
(1) I cannot figure out how to detect combinations (eg Ctrl+A,
Shift+Win+F5,
etc.) The hook procedure triggers after any key, preventing
combinations
from registering; ie, I get Ctrl by itself.
1. Ignore the Ctrl key down message, when you get a character you are
intrested in then check the state of the control or the shift or the alt
key
by using either GetKeyState, or GetKeyboardState.
That makes sense, but I am not interested in any specific key. I suppose I
could
test for anything that's NOT a modifier. AltGr is a modifier right? I'm
not
shooting for full internationalization, but I may as well support that one
common one. :)
(2) I need a way to call the (button) control's SetWindowText from the
hook
procedure and to store the detected hotkey and its modifiers in the
control.
2. Store the pointer to you button in a global somewhere where the hook
function has access to it.
That's what I'm doing, but what happens if there's more than one of this
control
in a dialog?
I'm trying to create a hotkey control that can detect any keys or
combinations
(at least more than the standard one). I've modeled mine after XMPlay's
shortcut
hotkey control: a button that you click which traps its next keyboard
event.
It's coming along great. I've created the control, basing it on
CButton,
which
calls SetWindowsHookEx from OnBnClicked. I can trap the next key and
call
UnhookWindowsHookEx in the hook proc. I've now run into two problems:
--
Alec S.
news/alec->synetech/cjb/net