ChildWindowFromPointEx function (winuser.h)

Determines which, if any, of the child windows belonging to the specified parent window contains the specified point. The function can ignore invisible, disabled, and transparent child windows. The search is restricted to immediate child windows. Grandchildren and deeper descendants are not searched.

Syntax

HWND ChildWindowFromPointEx(
  [in] HWND  hwnd,
  [in] POINT pt,
  [in] UINT  flags
);

Parameters

[in] hwnd

Type: HWND

A handle to the parent window.

[in] pt

Type: POINT

A structure that defines the client coordinates (relative to hwndParent) of the point to be checked.

[in] flags

Type: UINT

The child windows to be skipped. This parameter can be one or more of the following values.

Value Meaning
CWP_ALL
0x0000
Does not skip any child windows
CWP_SKIPDISABLED
0x0002
Skips disabled child windows
CWP_SKIPINVISIBLE
0x0001
Skips invisible child windows
CWP_SKIPTRANSPARENT
0x0004
Skips transparent child windows

Return value

Type: HWND

The return value is a handle to the first child window that contains the point and meets the criteria specified by uFlags. If the point is within the parent window but not within any child window that meets the criteria, the return value is a handle to the parent window. If the point lies outside the parent window or if the function fails, the return value is NULL.

Remarks

The system maintains an internal list that contains 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 and meets the criteria specified by uFlags.

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

Conceptual

Other Resources

POINT

Reference

WindowFromPoint

Windows