Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GetAncestor function

Retrieves the handle to the ancestor of the specified window.

Syntax


HWND WINAPI GetAncestor(
  _In_ HWND hwnd,
  _In_ UINT gaFlags
);

Parameters

hwnd [in]

Type: HWND

A handle to the window whose ancestor is to be retrieved. If this parameter is the desktop window, the function returns NULL.

gaFlags [in]

Type: UINT

The ancestor to be retrieved. This parameter can be one of the following values.

ValueMeaning
GA_PARENT
1

Retrieves the parent window. This does not include the owner, as it does with the GetParent function.

GA_ROOT
2

Retrieves the root window by walking the chain of parent windows.

GA_ROOTOWNER
3

Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.

 

Return value

Type:

Type: HWND

The return value is the handle to the ancestor window.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
GetParent
Conceptual
Windows

 

 

Show:
© 2017 Microsoft