AutomationElement.ProcessIdProperty フィールド

定義

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

注釈

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

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

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

適用対象

こちらもご覧ください