AutomationElement.ProcessIdProperty 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
識別該 ProcessId 物業。
public: static initonly System::Windows::Automation::AutomationProperty ^ ProcessIdProperty;
public static readonly System.Windows.Automation.AutomationProperty ProcessIdProperty;
staticval mutable ProcessIdProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ProcessIdProperty As AutomationProperty
欄位值
範例
以下範例取得該屬性的當前值。 若元素未提供預設值,則回傳預設值。
int processIdentifier = (int)
autoElement.GetCurrentPropertyValue(AutomationElement.ProcessIdProperty);
Dim processIdentifier As Integer = _
CInt(autoElement.GetCurrentPropertyValue(AutomationElement.ProcessIdProperty))
以下範例取得該屬性的當前值,但指定若元素本身未提供屬性值, NotSupported 則回傳該屬性而非預設值。
int processIdentifier1;
object processIdentifierNoDefault =
autoElement.GetCurrentPropertyValue(AutomationElement.ProcessIdProperty, true);
if (processIdentifierNoDefault == AutomationElement.NotSupported)
{
// TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
processIdentifier1 = (int)processIdentifierNoDefault;
}
Dim processIdentifier1 As Integer
Dim processIdentifierNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ProcessIdProperty, True)
If processIdentifierNoDefault Is AutomationElement.NotSupported Then
' TODO Handle the case where you do not wish to proceed using the default value.
Else
processIdentifier1 = CInt(processIdentifierNoDefault)
End If
備註
此識別碼用於 使用者介面自動化 客戶端應用程式。 使用者介面自動化提供者應使用等效的識別碼為 AutomationElementIdentifiers。
此屬性也可從 Current 或 Cached 屬性中取得。
屬性的回傳值型別 Int32為 。 該屬性的預設值為 0。