网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

鼠标静止不动时候的消息-创新互联

优化程序的时候发现鼠标放在控件上不动也会不停的收到WM_MOUSEMOVE消息。

创新互联提供成都网站设计、成都网站建设、网页设计,高端网站设计1元广告等致力于企业网站建设与公司网站制作,10余年的网站开发和建站经验,助力企业信息化建设,成功案例突破近千家,是您实现网站建设的好选择.

1,

于是想了各种办法寻找是哪儿触发的。

bp USER32!PostMessageW ".echo PostMessageW_Breakpoint_hit; g"

bp USER32!SendMessageW ".echo SendMessageW_Breakpoint_hit; g"

*Message没有抓到WM_MOUSEMOVE消息,却触发了该消息。

0:035> x USER32!*PostMessage*

76483baa USER32!PostMessageA =

764812a5 USER32!PostMessageW =

764904e3 USER32!PackAndPostMessage =

76481285 USER32!NtUserPostMessage =

0:035> x USER32!*SendMessage*

7648781f USER32!SendMessageTimeoutA =

764e0030 USER32!_imp__WinStationSendMessageW =

764797d2 USER32!SendMessageTimeoutW =

7647d611 USER32!SendMessageToUI =

764838ee USER32!InSendMessageEx =

764da9a8 USER32!WinStationSendMessageW =

764d886b USER32!NtUserQuerySendMessage =

764797fc USER32!SendMessageTimeoutWorker =

*Message* 全部bp一遍也没有抓到。

2,

用vs2005创建一个WIN32程序,只在WndProc里面加上WM_MOUSEMOVE的打印:

鼠标不动依然受到了WM_MOUSEMOVE消息,

3,

原来鼠标在窗口上不动也会收到这几个消息:

#define WM_GETICON 0x007F
#define WM_NCHITTEST 0x0084
#define WM_SETCURSOR 0x0020
#define WM_MOUSEMOVE 0x0200

-------------------------------------------------------------!

用spy++抓了一下,有的窗口能抓到有的不能抓到。

4,

看看MSDN怎么说

his message is posted to a window when user moves the mouse while pressing the left mouse button or moves the stylus while the tip is down. If another window does not capture the mouse stylus input, the OS posts the message to the window that contains the cursor or the stylus tip. If another window captures the mouse or stylus input, the OS posts the message to the window that has the capture.

Okay, so back to the original question, "Why do I get spurious WM_MOUSEMOVE messages?"

Notice that the delivery of a mouse message includes lots of work that is typically thought of as being part of mouse movement. Often, Windows wants to do that follow-on work even though the mouse hasn't actually moved. The most obvious example is when a window is shown, hidden or moved. When that happens, the mouse cursor may be over a window different from the window it was over previously (or in the case of a move, it may be over a different part of the same window). Windows needs to recalculate the mouse cursor (for example, the old window may have wanted an arrow but the new window wants a pointy finger), so it artificially sets the "The mouse moved, in case anybody cares" flag. This causes all the follow-on work to happen, a side-effect of which is the generation of a spuriousWM_MOUSEMOVE message.


文章标题:鼠标静止不动时候的消息-创新互联
链接分享:http://bjjierui.cn/article/iddoi.html

其他资讯