I want to perform some action when the user presses CTRL+S
inside a modeless dialog.
Accelerators would be perfect for this, except that I don't have control over the thread's message loop (think plugin), so I can't call TranslateAccelerator
.
A nested message loop is not an option because the main application does a lot of processing in between calls to PeekMessage
.
- Is there some way I can 'force' the existing message loop to handle my accelerator?
- Is there any other way besides accelerators to catch
CTRL+S
?
I thought about using a Window hooks on WH_GETMESSAGE
, which gets called before returning from GetMessage
or PeekMessage
. But I'm not sure what would happen after I successfully called TranslateAcellerator
, I can't let the application know I handled it.
WH_MSGFILTER
would require the app to implement a call to CallMsgFilter
, which it doesn't from a quick glance with a debugger.
My last idea was subclassing the control which is what I'm trying to avoid. That would require some mechanism to signal the keypress event to the parent window, which I don't think is a great design. Also, if I add more controls I would have to subclass every single one.
Thanks for any hints.