GetAncestor function (winuser.h)
Retrieves the handle to the ancestor of the specified window.
HWND GetAncestor( HWND hwnd, UINT gaFlags );
A handle to the window whose ancestor is to be retrieved. If this parameter is the desktop window, the function returns NULL.
The ancestor to be retrieved. This parameter can be one of the following values.
||Retrieves the parent window. This does not include the owner, as it does with the GetParent function.|
||Retrieves the root window by walking the chain of parent windows.|
||Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.|
The return value is the handle to the ancestor window.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|API set||ext-ms-win-ntuser-window-l1-1-1 (introduced in Windows 8.1)|