语言

AutomationElement.GetRuntimeId 方法

定义

检索分配给用户界面 (UI) 项的唯一标识符。

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

返回

Int32[]

表示运行时标识符的整数数组。

例外

示例

以下示例演示如何检索 . AutomationElement的运行时标识符。

// element is an AutomationElement.
int[] id = element.GetRuntimeId();
' element is an AutomationElement.
Dim id As Integer() = element.GetRuntimeId()

注解

仅保证标识符对生成该标识符的桌面的 UI 是唯一的。 可以随着时间的推移重复使用标识符。

将来的版本中,运行时标识符的格式可能会更改。 返回的标识符应被视为不透明值,仅用于比较;例如,若要确定是否 AutomationElement 在缓存中。

适用于