简体   繁体   English

在父窗口中捕获WM_MOUSEMOVE事件

[英]Capturing WM_MOUSEMOVE events in parent window

I have a (parent) window in which a child-window is created by a another library (Ogre3d). 我有一个(父)窗口,其中另一个库(Ogre3d)创建了一个子窗口。 Window initialization uses the bare Win32 API. 窗口初始化使用裸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. 我想在父窗口中捕获鼠标输入,但是好像我的WM_MOUSEMOVE事件仅由子窗口接收,这很有意义,因为这填满了我的所有客户端区域。

Is there a way to capture the WM_MOUSEMOVE messages in the parent window or (unintrusively) redirect those messages from the child-window? 有没有一种方法可以在父窗口中捕获WM_MOUSEMOVE消息或(非侵入性地)从子窗口重定向这些消息?

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. 链接的文章应该可以帮助您找到所需的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM