Capture keypresses from all child windows in mfc?
Posted on 2011-02-26
This should be a really simple one but for some reason I can't see why it isn't working. I have a PretranslateMsg override in my CFrameWnd derived top level window. This window has a number of child dialogs, each of which have child dialogs and / or controls themselves. Although from what I can see the parent chain is correct when creating these windows (ultimately they all lead back up to the top level window), for some reason events suchs as keypresses are not being reported if for example a control in a nested child dialog (such as a combo box) has focus. I need global key reponse in my app for shortcut keys, but without having to bugger about with Windows Hooks / Hotkeys or anything silly like that when really this should be MFC 101. Is there a property I need to set on my nested child controls to force them to propogate any keypresses back up the chain, or have I missed something more fundamental?
Sorry to be so stupid :-/