AutomationInteropProvider.HostProviderFromHandle(IntPtr) Method

Definition

Returns a UI Automation provider that represents the specified window.

C#
public static System.Windows.Automation.Provider.IRawElementProviderSimple HostProviderFromHandle(IntPtr hwnd);

Parameters

hwnd
IntPtr

The handle of the window.

Returns

The raw element provider for the specified window.

Examples

C#
/// <summary>
/// Gets the host provider.
/// </summary>
/// <remarks>
/// Fragment roots return their window providers; most others return null.
/// </remarks>
IRawElementProviderSimple IRawElementProviderSimple.HostRawElementProvider  
{
    get 
    {
        return AutomationInteropProvider.HostProviderFromHandle(myHandle);  
    }
}

Remarks

The interface returned by this method can only be passed back to UI Automation. Attempting to call a method on the interface will raise an exception.

Applies to

Product Versions
.NET Framework 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