Control.FromChildHandle(IntPtr) Method

Definition

Retrieves the control that contains the specified handle.

C#
public static System.Windows.Forms.Control FromChildHandle(IntPtr handle);
C#
public static System.Windows.Forms.Control? FromChildHandle(IntPtr handle);

Parameters

handle
IntPtr

The window handle (HWND) to search for.

Returns

The 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 FromHandle method, because it correctly returns controls that own more than one handle.

Applies to

Produkt Versioner
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also