Windows消息Capture

MSDN关于WM_MOUSEMOVE的说明:
The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
也就是说,你在比如ControlY单击鼠标后,系统就SetCapture,鼠标就被当前的Window Capture了(即ControlY),当你放开鼠标时才Release鼠标,因此此时当你把鼠标move到ControlX时,实际上是有WM_MOUSEMOVE事件发生的,只不过是Windows把此消息发给ControlY了,由ControlY的窗口过程处理的此消息。
由此可知,解决此问题有两种办法:
1:在ControlY单击鼠标后,设法不让Windows Capture鼠标;
2:在ControlY的WM_MOUSEMOVE事件中判断鼠标当前位置是不是在ControlX上,如果是,说明是在ControlX上MOUSEMOVE。

SetCapture

ReleaseCapture;//释放Mouse

转载于:https://www.cnblogs.com/tk-del/archive/2013/04/11/3014326.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值