1. Determine which window the mouse button is clicked on. Windows uses the table to record the regional coordinates of each window on the current screen, and when the mouse driver notifies windows that the mouse button is pressed, Windows determines which window is clicked, based on the coordinates of the mouse.
2. Determine which part of the window the mouse button is clicked on. Windows will want to click on the mouse button to send a wm_nchittest message, to ask the mouse button click on which part of the window. (The return value of the WM_NCHITTEST message response function notifies Windows). Generally speaking, wm_nchittest messages are handled by the system, and the user generally does not take the initiative to deal with it (that is, the WM_NCHITTEST message response function usually takes the Windows default handler function).
3. According to the mouse button click on the part of the window to send the corresponding message. For example, if the return value of the WM_NCHITTEST message response function is htclient, indicating that the mouse is clicked on the client area, Windows sends a WM_LBUTTONDOWN message to the window if wm_ The return value of Nchittest's message response function is not htclient (possibly Htcaption, htclose, Htmaxbutton, etc.), which is the non-client area of the mouse click, and Windows sends a WM_NCLBUTTONDOWN message to the window.
Knowledge about Windows Mouse response