ChildWindowFromPoint function (winuser.h)

Determines which, if any, of the child windows belonging to a parent window contains the specified point. The search is restricted to immediate child windows. Grandchildren, and deeper descendant windows are not searched.

To skip certain child windows, use the ChildWindowFromPointEx function.

Syntax

HWND ChildWindowFromPoint(
  [in] HWND  hWndParent,
  [in] POINT Point
);

Parameters

[in] hWndParent

Type: HWND

A handle to the parent window.

[in] Point

Type: POINT

A structure that defines the client coordinates, relative to hWndParent, of the point to be checked.

Return value

Type: HWND

The return value is a handle to the child window that contains the point, even if the child window is hidden or disabled. If the point lies outside the parent window, the return value is NULL. If the point is within the parent window but not within any child window, the return value is a handle to the parent window.

Remarks

The system maintains an internal list, containing the handles of the child windows associated with a parent window. The order of the handles in the list depends on the Z order of the child windows. If more than one child window contains the specified point, the system returns a handle to the first window in the list that contains the point.

ChildWindowFromPoint treats an HTTRANSPARENT area of a standard control the same as other parts of the control. In contrast, RealChildWindowFromPoint treats an HTTRANSPARENT area differently; it returns the child window behind a transparent area of a control. For example, if the point is in a transparent area of a groupbox, ChildWindowFromPoint returns the groupbox while RealChildWindowFromPoint returns the child window behind the groupbox. However, both APIs return a static field, even though it, too, returns HTTRANSPARENT.

Examples

For an example, see "Creating a Combo Box Toolbar" in Using Combo Boxes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows 10, version 10.0.14393)

See also

ChildWindowFromPointEx

Conceptual

Other Resources

POINT

RealChildWindowFromPoint

Reference

WindowFromPoint

Windows