IRawElementProviderFragment.GetRuntimeId メソッド

定義

要素のランタイム識別子を取得します。

public:
 cli::array <int> ^ GetRuntimeId();
public int[] GetRuntimeId();
abstract member GetRuntimeId : unit -> int[]
Public Function GetRuntimeId () As Integer()

返品

Int32[]

要素の一意のランタイム識別子。

次のコード例は、リスト ボックス内の項目など、フラグメント内の要素によるこのメソッドの実装を示しています。 項目はフラグメントのこのインスタンス内に独自の一意識別子を持ち、AppendRuntimeId 値により、メソッドによって返される識別子がUI オートメーション ツリー内で一意であることが保証されます。

/// <summary>
/// Gets the runtime identifier of the UI Automation element.
/// </summary>
/// <remarks>
/// myID is a unique identifier for the item within this instance of the list.
/// </remarks>
public int[] GetRuntimeId()
{
    return new int[] { AutomationInteropProvider.AppendRuntimeId, myID };
}
''' <summary>
''' Gets the runtime identifier of the UI Automation element.
''' </summary>
''' <remarks>
''' myID is a unique identifier for the item within this instance of the list.
''' </remarks>
Public Function GetRuntimeId() As Integer() _
    Implements IRawElementProviderFragment.GetRuntimeId

    Return New Integer() {AutomationInteropProvider.AppendRuntimeId, myID}

End Function 'GetRuntimeId

注釈

実装では、ウィンドウ ハンドルに対応する要素の null を返す必要があります。 他の要素は、 AppendRuntimeIdを含む配列を返し、その後にフラグメント内で一意の値を返す必要があります。

フラグメント内の一意性を確保するのはプロバイダーの責任です。たとえば、リスト内の各項目には個別に番号を付ける必要があります。 UI オートメーション エンジンは、AppendRuntimeId 値を変換することで、識別子がすべてのインスタンス間で一意であることを保証します。

適用対象

こちらもご覧ください