System.Windows.Forms.Control.FromChildHandle Method

Retrieves the control that contains the specified handle.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
public static Control FromChildHandle (IntPtr handle)

Parameters

handle
The window handle (HWND) to search for.

Returns

The System.Windows.Forms.Control that represents the control associated with the specified handle; returns null if no control with the specified handle is found.

Remarks

This method searches up the window handle parent chain until it finds a handle that is associated with a control. This method is more reliable than the Control.FromHandle(IntPtr) method, because it correctly returns controls that own more than one handle.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0