IRawElementProviderFragment.GetRuntimeId Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Retrieves the runtime identifier of an element.

Namespace:   System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

int[] GetRuntimeId()

Return Value

Type: System.Int32[]

The unique run-time identifier of the element.

Implementations should return null for an element that corresponds to a window handle. Other elements should return an array that contains AppendRuntimeId, followed by a value that is unique within the fragment.

It is the provider's responsibility to ensure uniqueness within the fragment; for example, each item in a list must be individually numbered. The UI Automation engine ensures that the identifier is unique among all instances, by translating the AppendRuntimeIdvalue.

The following example code shows an implementation of this method by an element within a fragment, such as an item within a list box. The item has its own unique identifier within this instance of the fragment, and the AppendRuntimeId value ensures that the identifier returned by the method is unique in the UI Automation tree.

/// <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 };
}

.NET Framework
Available since 3.0
Return to top
Show: