AutomationInteropProvider.HostProviderFromHandle(IntPtr) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回表示指定的窗口的 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
窗口的句柄。
返回
指定窗口的原始元素提供程序。
示例
/// <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
注解
此方法返回的接口只能传递回UI 自动化。 尝试在接口上调用方法将引发异常。