5

We developped an MFC application where the main window was implemented in a DLL. In an attempt to revamp it, we are thinking of changing this to a WPF-application where the "old" native window gets rehosted in a Wpf-Window. So far so good.

However, our old MFC application trapped some messages at the application level (ex: preventing mouse-clicks or keyboard inputs). To rehost the MFC-window inside the WPF-application, we need a way to catch these from the WPF-application and ask the old MFC-window to pre-translate them...

Is this possible at all?

I was thinking of rehosting the MFC window in a HwndHost, then add a message hook. The code in my bridging CLR-DLL looks like this (and doesn't achieve what I want):

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

Can anyone help?

vulkanino
  • 9,074
  • 7
  • 44
  • 71
Seb
  • 143
  • 2
  • 10

0 Answers0