Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
GetAncestor (user32)
.
C# Signature:
/// <summary>
/// Retrieves the handle to the ancestor of the specified window.
/// </summary>
/// <param name="hwnd">A handle to the window whose ancestor is to be retrieved.
/// If this parameter is the desktop window, the function returns NULL. </param>
/// <param name="flags">The ancestor to be retrieved.</param>
/// <returns>The return value is the handle to the ancestor window.</returns>
[DllImport("user32.dll", ExactSpelling = true)]
static extern IntPtr GetAncestor(IntPtr hwnd, GetAncestorFlags flags);
VB.NET Signature:
<DllImport("user32.dll", ExactSpelling:=True)> _
Private Shared Function GetAncestor(ByVal hwnd As IntPtr, ByVal gaFlags As GetAncestor_Flags) As IntPtr
End Function
private const uint GA_PARENT = 1; // Retrieves the parent window.This does not include the owner, as it does with the GetParent function.
private const uint GA_ROOT = 2; // Retrieves the root window by walking the chain of parent windows.
private const uint GA_ROOTOWNER = 3; // Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.
public const uint GA_PARENT = 1; // Retrieves the parent window.This does not include the owner, as it does with the GetParent function.
public const uint GA_ROOT = 2; // Retrieves the root window by walking the chain of parent windows.
public const uint GA_ROOTOWNER = 3; // Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.
Tips & Tricks:
Please add some!
Sample Code:
Please add some!
Alternative Managed API:
Do you know one? Please contribute it!
The GetAncestor API
4/6/2016 7:49:35 PM - foamstone-96.82.78.145
Used with the GetAncestor function
1/17/2013 12:33:54 PM - -64.111.150.32
The GetParent API
4/14/2017 12:49:01 PM - -78.110.196.168
The GetParent API
4/14/2017 12:49:01 PM - -78.110.196.168
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).