How to check if the mouse is above the control

How to check if the mouse is over a specific HWND? I tried using the WM_MOUSELEAVE and WM_MOUSEMOVE messages for tracking, but if you click on the button and pull the mouse out of the button, it will not receive WM_MOUSELEAVE until the mouse is released, which is too late because:

When you press the button, the WM_COMMAND message is sent only if:
1. The mouse was originally pressed above the button
2. The mouse is above the button
3. The mouse is released above the button

I need to replicate this functionality.

+3
source share
2 answers

, SetCapture(), , . , / ( 100%, ). , , ReleaseCapture() .

EDIT: , Windows API WindowFromPoint(), , .

+3

Windows, " ", SetCapture (hWnd). , . WM_LBUTTONDOWN.

+2

Source: https://habr.com/ru/post/1781348/


All Articles