ProcessCmdKey - wait for KeyUp?
Posted
by Tom Frey
on Stack Overflow
See other posts from Stack Overflow
or by Tom Frey
Published on 2010-03-12T18:15:55Z
Indexed on
2010/03/12
18:17 UTC
Read the original article
Hit count: 380
Hi,
I'm having the following issue in a WinForms app. I'm trying to implement Hotkeys and I need to process Key messages whenever the control is active, no matter if the focus is on a textbox within that control, etc.
Overriding ProcessCmdKey works beautifully for this and does exactly what I want with one exception:
If a user presses a key and keeps it pressed, ProcessCmdKey keeps triggering WM_KEYDOWN events.
However, what I want to achieve is that the user has to release the button again before another hotkey action would trigger (so, if someone sits on the keyboard it would not cause continuous hotkey events).
However, I can't find where to catch WM_KEYUP events, so I can set a flag if it should process ProcessCmdKey messages again?
Anyone can help out here?
Thanks,
Tom
© Stack Overflow or respective owner