ChildWindowFromPoint function

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(
  HWND  hWndParent,
  POINT Point
);

Parameters

hWndParent

Type: HWND

A handle to the parent window.

Point

Type: POINT

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

Return Value

Type: 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

   
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

See Also

ChildWindowFromPointEx

Conceptual

Other Resources

POINT

RealChildWindowFromPoint

Reference

WindowFromPoint

Windows