The WM_NCHITTEST 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.
Read more: The old new thing
- The default WM_SETCURSOR handler uses the result of WM_NCHITTEST to figure out what type of cursor to show. for example, if you return HTLEFT, then DefWindowProc will show the IDC_SIZEWE cursor.
- If the user clicks the mouse, the default WM_NCLBUTTONDOWN handler uses the result of WM_NCHITTEST to figure out where on the window you clicked. For example, if you return HTCLOSE, then it will act as if the user clicked on the Close button.
- The WindowFromPoint function uses WM_NCHITTEST in its quest to figure out which window is under the point you passed in. If you return HTTRANSPARENT, then it will skip your window and keep looking.
- Drag/drop operations use the result of WM_NCHITTEST to figure out what part of the window you are dragging over.
- Accessibility tools use the result of WM_NCHITTEST to help the user understand what's on the screen.
- Anybody can use the result of WM_NCHITTEST 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