The WindowFromPoint function retrieves the handle of the window that contains the specified point.
HWND WindowFromPoint(
POINT Point |
// structure with point |
); |
The return value is the handle of the window that contains the point. If no window exists at the given point, the return value is NULL. If the point is over a static text control, the return value is the handle of the window under the static text control.
The WindowFromPoint function does not retrieve the handle of a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search.