AutomationElement.ProcessIdProperty Pole

Definicja

Identyfikuje ProcessId właściwość .

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 

Wartość pola

Przykłady

Poniższy przykład pobiera bieżącą wartość właściwości. Wartość domyślna jest zwracana, jeśli element nie podaje go.

int processIdentifier = (int)
    autoElement.GetCurrentPropertyValue(AutomationElement.ProcessIdProperty);
Dim processIdentifier As Integer = _
    CInt(autoElement.GetCurrentPropertyValue(AutomationElement.ProcessIdProperty))

Poniższy przykład pobiera bieżącą wartość właściwości, ale określa, że jeśli sam element nie podaje wartości właściwości, NotSupported należy zwrócić zamiast wartości domyślnej.

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

Uwagi

Ten identyfikator jest używany przez aplikacje klienckie automatyzacja interfejsu użytkownika. automatyzacja interfejsu użytkownika dostawcy powinni użyć równoważnego identyfikatora w pliku AutomationElementIdentifiers.

Tę właściwość można również pobrać z Current właściwości lub Cached .

Zwracane wartości właściwości są typu Int32. Wartość domyślna właściwości to 0.

Dotyczy

Zobacz też