A | B | C |  D | E | F |  G | H | I |  J | K | L |  M | N | O |  P | Q | R |  S | T | U |  V | W | X |  Y | Z



GetAncestor

The GetAncestor function retrieves the handle to the ancestor of the specified window.

VB4-32,5,6
Declare Function GetAncestor Lib "user32.dll" (ByVal hwnd As Long, ByVal gaFlags As Long) As Long

VB.NET
System.Windows.Forms.Form.Owner

Operating Systems Supported
Requires Windows NT 4.0 SP4 or later; Requires Windows 98

Library
User32

Parameter Information
- hwnd
[in] Handle to the window whose ancestor is to be retrieved. If this parameter is the desktop window, the function returns NULL.

- gaFlags
[in] Specifies the ancestor to be retrieved. This parameter can be one of the following values.
GA_PARENT
Retrieves the parent window. This does not include the owner, as it does with the GetParent function.
GA_ROOT
Retrieves the root window by walking the chain of parent windows.
GA_ROOTOWNER
Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.

Return Values
The return value is the handle to the ancestor window.

Last update: 07 April 2006