共用方式為


AutomationInteropProvider.HostProviderFromHandle(IntPtr) 方法

定義

傳回代表所指定視窗的 UI 自動化提供者。

public:
 static System::Windows::Automation::Provider::IRawElementProviderSimple ^ HostProviderFromHandle(IntPtr hwnd);
public static System.Windows.Automation.Provider.IRawElementProviderSimple HostProviderFromHandle (IntPtr hwnd);
static member HostProviderFromHandle : nativeint -> System.Windows.Automation.Provider.IRawElementProviderSimple
Public Shared Function HostProviderFromHandle (hwnd As IntPtr) As IRawElementProviderSimple

參數

hwnd
IntPtr

nativeint

視窗控制代碼。

傳回

IRawElementProviderSimple

所指定視窗的原始項目提供者。

範例

/// <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);  
    }
}
''' <summary>
''' Gets the host provider.
''' </summary>
''' <remarks>
''' Fragment roots return their window providers; most others return null.
''' </remarks>
ReadOnly Property HostRawElementProvider() As IRawElementProviderSimple _
    Implements IRawElementProviderSimple.HostRawElementProvider

    Get
        Return AutomationInteropProvider.HostProviderFromHandle(myHandle)
    End Get
End Property

備註

這個方法傳回的介面只能傳回至消費者介面自動化。 嘗試在介面上呼叫方法將會引發例外狀況。

適用於