PreTranslateMessage in C # for hosted MFC window

We developed an MFC application where the main window was implemented in a DLL. In an attempt to update it, we are thinking of changing this to a WPF application in which the “old” native window will be restored to Wpf-Window. So far so good.

However, our old MFC application captured some messages at the application level (for example: preventing mouse clicks or keyboard input). To restart the MFC window inside the WPF application, we need a way to catch them from the WPF application and ask the old MFC window to translate them first ...

Is this even possible?

I thought about accessing the MFC window again in HwndHost, and then adding a message hook. The code for my CLR-DLL bridge looks like this (and doesn't reach what I want):

MyHwndHost ^handle = gcnew MyHwndHost(pContentWnd);
handle->MessageHook += gcnew HwndSourceHook(&CVSimCoreNat::ControlMsgFilter);

Can anyone help?

+5
source share

All Articles