开发者

Why do .Net applications receive WM_NCHITTEST twice?

开发者 https://www.devze.com 2023-03-31 19:40 出处:网络
I\'m doing a function that seamless simulates the messages generated by SendInput. So far i\'m sending WM_NCHITTEST to the window.

I'm doing a function that seamless simulates the messages generated by SendInput.

So far i'm sending WM_NCHITTEST to the window. Then WM_SETCURSOR with the result of the hit test. And finally WM_MOUSEMOVE.

But some windows (ie: visualstudio, .net ones) receive a sequence of 2 or more identical WM_NCHITTEST.

How can i know how many hit tests are sent to a window?

/*Example from vstudio 2010:*/
<15008> 000E030E S WM_NCHITTEST xPos:509 yPos:543   //1st
<15009> 000E030E R WM_NCHITTEST nHittest:HTCLIENT
<15010> 000E030E S WM_NCHITTEST xPos:509 yPos:543   //2nd
<15011> 000E030E R WM_NCHITTEST nHittest:HTCLIENT
<15012> 000E030E S WM_SETCURSOR hwnd:000E030E nHittest:HTCLIENT wMouseMsg:WM_MOUSEMOVE
<15013> 000E030E R WM_SETCU开发者_JS百科RSOR fHaltProcessing:False
<15014> 000E030E P WM_MOUSEMOVE fwKeys:0000 xPos:509 yPos:543


The Windows OS or any application may send WM_NCHITTEST for any coordinate anytime it needs to inquire about the geometry of your window. If your code makes any assumptions at all about when it is called, your code is wrong.

In theory, "Because I felt like it" is a valid answer to "why did you send WM_NCHITTEST."

In the broad sense, simulating SendInput() by SendMessage() doesn't work right. You should stop trying to do that.

0

精彩评论

暂无评论...
验证码 换一张
取 消