winformsmfcaccelerator

Detecting keyboard shortcuts in WinForm swallowed by host mfc accelerators


I have a MFC MDI app which defines Ctrl-F as a keyboard accelerator. This app hosts a WinForm dialog. My problem is I want to catch Ctrl-F from this child WinForm dialog but the MFC mainframe seems to be swallowing it.

Do you think there is a way to receive those key press in the WinForm child?


Solution

  • I've found a solution that works. When showing the c# WinForm, use the overload

    Form.Show(IWin32Window owner)
    

    and pass the MFC mainframe Hwnd as the owner. Now everything is working as expected.