[MFC]如何在Dlg中输入WM_MOUSEMOVE事件? [英] [MFC] How to enter WM_MOUSEMOVE event in Dlg?

查看:277
本文介绍了[MFC]如何在Dlg中输入WM_MOUSEMOVE事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。

我在dlgClass中添加了wm_mousemove事件。

当我在Dialog中的ListCtrl,ButtonCtrl,Combobox,editCtrls上移动鼠标点时,它没有进入MouseMove活动。

为什么没有输入mousemove ....



如何输入wm_mousemove事件而不管ctrls。

hello.
I added wm_mousemove event in dlgClass.
When I moved mouse point on ListCtrl, ButtonCtrl, Combobox, editCtrls in Dialog, it didn't enter MouseMove Event.
why didn't enter mousemove....

how to enter wm_mousemove event regardless of ctrls.

推荐答案

当未捕获鼠标时, WM_MOUSEMOVE 消息将发布到鼠标光标下方的窗口中。因此,当鼠标悬停在控件上时,消息将被发布到控制窗口而不是对话框窗口。



解决方案是在对话框窗口中捕获鼠标。然后当光标在窗口上时,所有鼠标消息都被发送到捕获的窗口,或者在窗口上方按下鼠标按钮并且按钮仍然按下时。



请参阅 CWnd :: SetCapture [ ^ ]。文章正确使用SetCapture()和ReleaseCapture()(通常在拖拽期间)放弃操作)。 [ ^ ]也可能有用。
The WM_MOUSEMOVE message is posted to the window beneath the mouse cursor when the mouse is not captured. So the message is posted to the control window and not the dialog window when the mouse is over a control.

The solution is to capture the mouse in the dialog window. Then all mouse messages are send to the captured window when the cursor is over the window, or the mouse button was pressed when over the window and the button is still down.

See CWnd::SetCapture[^] in the MSDN. The article Using SetCapture() and ReleaseCapture() correctly (usually during a drag n' drop operation).[^] may be also useful.


这篇关于[MFC]如何在Dlg中输入WM_MOUSEMOVE事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆