1 out of 1 rated this helpful - Rate this topic

RealChildWindowFromPoint function

Applies to: desktop apps only

Retrieves a handle to the child window at the specified point. The search is restricted to immediate child windows; grandchildren and deeper descendant windows are not searched.

Syntax

HWND WINAPI RealChildWindowFromPoint(
  __in  HWND hwndParent,
  __in  POINT ptParentClientCoords
);

Parameters

hwndParent [in]

Type: HWND

A handle to the window whose child is to be retrieved.

ptParentClientCoords [in]

Type: POINT

A POINT structure that defines the client coordinates of the point to be checked.

Return value

Type:

Type: HWND

The return value is a handle to the child window that contains the specified point.

Remarks

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

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
ChildWindowFromPoint
Conceptual
Windows
Other Resources
POINT

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
They all don't do what they should
It does not matter if you use WindowFromPoint, ChildWindowFromPoint, ChildWindowFromPointEx or RealChildWindowFromPoint. None of these functions returns ALWAYS the windows under the given point. These functions work in some cases, but none of them works correctly ALWAYS. The one the works best to obtain the window at the given point is RealChildWindowFromPoint. But also this function fails if you have a Dialog in a TabControl like in Microsoft`s Html Help Workshop for example. In this case the funtion returns the Tab Control although the given point lies in the smaller Dialog (ListBox). So if you need a realiable function that works corretcly ALWAYS you will end up writing your own code. You have to test with a lot of applications to find out if your code realy works correctly in all cases. Don't forget to test also RTL scenarios! It is a shame that Microsoft is not able to give a function that works correctly.
Comparison of different *WindowFromPoint* methods

Raymond Chen discusses the different methods here:

http://blogs.msdn.com/b/oldnewthing/archive/2010/12/30/10110077.aspx
"WindowFromPoint, ChildWindowFromPoint, RealChildWindowFromPoint, when will it all end?"