c++windowswinapimouseevent

Capturing WM_MOUSEMOVE events in parent window


I have a (parent) window in which a child-window is created by a another library (Ogre3d). Window initialization uses the bare Win32 API.

I'd like to capture the mouse input in my parent window, but it seems like I my WM_MOUSEMOVE events are received only by the child-window, which makes sense, since that fills all of my client-area.

Is there a way to capture the WM_MOUSEMOVE messages in the parent window or (unintrusively) redirect those messages from the child-window?


Solution

  • If you can obtain a handle to the window in question you can subclass it.

    In a nutshell, you get to register a callback function that gets a crack at all of the messages sent to the sub-classed window.

    The linked article should get you where you need to be.