This is a mirror of official site: http://jasper-net.blogspot.com/

WM_NCHITTEST is for hit-testing, and hit-testing can happen for reasons other than the mouse being over your window

| Sunday, February 20, 2011
The WM_NC­HIT­TEST message is sent to your window in order determine what part of the window corresponds to a particular point. The most common reason for this is that the mouse is over your window.
  • The default WM_SET­CURSOR handler uses the result of WM_NC­HIT­TEST to figure out what type of cursor to show. for example, if you return HT­LEFT, then Def­Window­Proc will show the IDC_SIZE­WE cursor.
  • If the user clicks the mouse, the default WM_NC­LBUTTON­DOWN handler uses the result of WM_NC­HIT­TEST to figure out where on the window you clicked. For example, if you return HT­CLOSE, then it will act as if the user clicked on the Close button.
Although WM_NC­HIT­TEST triggers most often for mouse activity, that is not the only reason why somebody might want to ask, "What part of the window does this point correspond to?"
  • The Window­From­Point function uses WM_NC­HIT­TEST in its quest to figure out which window is under the point you passed in. If you return HT­TRANSPARENT, then it will skip your window and keep looking.
  • Drag/drop operations use the result of WM_NC­HIT­TEST to figure out what part of the window you are dragging over.
  • Accessibility tools use the result of WM_NC­HIT­TEST to help the user understand what's on the screen.
  • Anybody can use the result of WM_NC­HIT­TEST to see how your window is laid out. We used it a few years ago to detect a right-click on the caption button.

Read more: The old new thing

Posted via email from Jasper-net

0 comments: