I had the following problem in a WinForms application. I am trying to implement hotkeys, and I need to process key messages whenever the control is active, regardless of whether it is concentrated in a text field inside this control, etc.
Overriding ProcessCmdKey works great for this and does exactly what I want with one exception:
If the user presses and holds the key, ProcessCmdKey continues to raise WM_KEYDOWN events.
However, I want to ensure that the user has to release the button again before another hotkey action is triggered (therefore, if someone sits on the keyboard, this will not cause continuous hotkey events).
However, I cannot find where to catch WM_KEYUP events, so can I set the flag if it should process ProcessCmdKey messages again?
Can anyone help here?
Thanks,
Tom
source
share