語言

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

備註

此識別碼用於 使用者介面自動化 客戶端應用程式。 使用者介面自動化提供者應使用等效的識別碼為 AutomationElementIdentifiers。

此屬性也可從 Current 或 Cached 屬性中取得。

屬性的回傳值型別 Int32為 。 該屬性的預設值為 0。

適用於

另請參閱