WPF WIN32 hwndhost WM_MOUSEMOVE WM_MOUSEHOVER

Posted by Neil B on Stack Overflow See other posts from Stack Overflow or by Neil B
Published on 2010-03-25T15:41:46Z Indexed on 2010/03/25 15:43 UTC
Read the original article Hit count: 565

Filed under:
|
|
|

I have a WPF app with a usercontrol that contains a HwndHost. The HwndHost is created as follows:

  hwndHost = CreateWindowEx(0, "static", "",
                            WS_CHILD | WS_VISIBLE,
                            0, 0,
                            hostHeight, hostWidth,
                            hwndParent.Handle,
                            (IntPtr)HOST_ID,
                            IntPtr.Zero,
                            0);

  hwndControl = CreateWindowEx(0, "Static", "",
                                WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
                                  ,
                                0, 0,
                                hostHeight, hostWidth,
                                hwndHost,
                                (IntPtr)PICTUREBOX_ID,
                                IntPtr.Zero,
                                0);

I then hook into the message pump using HwndSourceHook and loads of messages come through.

Except the ones I want i.e. WM_MOUSEMOVE, WM_MOUSEHOVER, WM_LBUTTONDOWN and WM_LBUTTONUP

Also the OnMouseLeftButtonDown event is not fired in the WPF code on the main window or the control, I assume because windows is trapping it and throwing it away.

Anybody know how I can get these to come through, either with or without using the WIN32 window messages?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about win32