IUIAutomationElement::GetRuntimeId 方法 (uiautomationclient.h)

检索分配给 UI 元素的唯一标识符。

语法

HRESULT GetRuntimeId(
  [out, retval] SAFEARRAY **runtimeId
);

参数

[out, retval] runtimeId

类型: SAFEARRAY**

以整数数组的形式接收指向运行时 ID 的指针。

返回值

类型: HRESULT

如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。

注解

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

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

要求

要求
最低受支持的客户端 Windows 7、带 SP2 的 Windows Vista 和适用于 Windows Vista 的平台更新、带 SP3 的 Windows XP 和适用于 Windows Vista 的平台更新 [仅限桌面应用]
最低受支持的服务器 Windows Server 2008 R2、带 SP2 的 Windows Server 2008 和适用于 Windows Server 2008 的平台更新、带 SP2 的 Windows Server 2003 和适用于 Windows Server 2008 的平台更新 [仅限桌面应用]
目标平台 Windows
标头 uiautomationclient.h (包括 UIAutomation.h)

另请参阅

Automation 元素属性 ID

使用安全数组的最佳做法

CompareRuntimeIds

概念性

IUIAutomationElement

引用