Hosted window in WPF doesn't get mouse messages

1k views Asked by At

Taking it a bit further than hosting WinForms user controls in my WPF application, I am actually hosting Delphi forms, i.e. top level windows. I am doing so through the voodoo in blog post How To Host Top-Level HWNDs In WPF.

Nearly everything works perfectly. I send a COM server, built in Delphi, a menu path string, and it sends back a window handle, which I pass to the host control described in the blog. The Delphi window receives nearly all events (rather, Windows Messages) correctly, without any intervention on my part.

The only problem is the buttons. They receive a click event/message fine, and work, but now the Delphi guys have added new icons to the buttons, and each button has an active icon, a hover icon, and a click icon. They receive none of the messages they should to change these icons. Why do nearly all messages work except these? What can I read and or do to try and correct this?

1

There are 1 answers

1
Toris On

In MouseOver event, send some user message and catch it.

WPF and Win32 Interoperation
HWNDs inside WPF > Notable Differences in Input behavior

While the mouse is over the HwndHost, your application does not receive WPF mouse events, and the value of the WPF property IsMouseOver will be false.