AutomationElement.NativeWindowHandleProperty フィールド

定義

NativeWindowHandle プロパティを識別します。

public: static initonly System::Windows::Automation::AutomationProperty ^ NativeWindowHandleProperty;
public static readonly System.Windows.Automation.AutomationProperty NativeWindowHandleProperty;
 staticval mutable NativeWindowHandleProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly NativeWindowHandleProperty As AutomationProperty 

フィールド値

次の例では、プロパティの現在の値を取得します。 要素に既定値が指定されていない場合は、既定値が返されます。

int nativeHandle = (int)
    autoElement.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty);
Dim nativeHandle As Integer = _
    CInt(autoElement.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty))

次の例では、プロパティの現在の値を取得しますが、要素自体がプロパティの値を提供しない場合は、既定値ではなく NotSupported を返すように指定します。

int nativeHandle1;
object nativeHandleNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty, true);
if (nativeHandleNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    nativeHandle1 = (int)nativeHandleNoDefault;
}
Dim nativeHandle1 As Integer
Dim nativeHandleNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty, True)
If nativeHandleNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    nativeHandle1 = CInt(nativeHandleNoDefault)
End If

注釈

この識別子は、クライアント アプリケーションUI オートメーション使用されます。 UI オートメーションプロバイダーは、AutomationElementIdentifiers で同等の識別子を使用する必要があります。

このプロパティは、 Current または Cached プロパティから取得することもできます。

プロパティの戻り値は、 Int32型です。 プロパティの既定値は 0 です。

適用対象

こちらもご覧ください