@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The GetParent API !!!!C# Signature: [DllImport("user32.dll", ExactSpelling=true, CharSet=CharSet.Auto)] public static extern IntPtr GetParent(IntPtr hWnd); !!!!VB.NET Signature: <DllImport("user32.dll", ExactSpelling:=True, CharSet:=CharSet.Auto)> _ Public Shared Function GetParent(ByVal hWnd As IntPtr) As IntPtr End Function !!!!Oxygene.NET Signature: [DllImport("user32.dll", ExactSpelling := true, CharSet := CharSet.Auto)] class method GetParent(hWnd: IntPtr): IntPtr; external; !!!!VB Signature: Public Declare Function GetParent Lib "user32" _ (ByVal hWnd As Long) As Long !!!!VBA7 Signature: Public Declare PtrSafe Function GetParent Lib "user32" (ByVal hwnd as LongPtr) as LongPtr !!!!Notes: GetParent sets LastError !!!!Tips & Tricks: Please add some! !!!!Sample Code: IntPtr GetParentSafe(IntPtr handle) { IntPtr result = GetParent(handle); if(result == IntPtr.Zero) { // An error occured throw new Win32Exception(Marshal.GetLastWin32Error()); } return result; } !!!!!Note: For the sample code above, FxCop reports: '''DoNotIndirectlyExposeMethodsWithLinkDemands''' 'NativeMethods.GetParentSafe(IntPtr)' calls into 'Marshal.GetLastWin32Error()' which has a LinkDemand. By making this call, 'Marshal.GetLastWin32Error()' is indirectly exposed to user code. Review the following protection: ->'NativeMethods.GetParentSafe(IntPtr)' ->'NativeMethods.GetParentSafe(IntPtr)' ->'MyClass.MyMethod.get()' !!!!Alternative Managed API: The ManagedWindowsApi project (http://mwinapi.sourceforge.net) provides a class ManagedWinapi.SystemWindow that has a Parent property. Documentation: GetParent@msdn on MSDN
Edit user32.getparent
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.