IUIAutomation::GetRootElementBuildCache 方法 (uiautomationclient.h)

检索表示桌面的 UI 自动化 元素,预提取请求的属性和控件模式,并将预提取的项存储在缓存中。

语法

HRESULT GetRootElementBuildCache(
  [in]          IUIAutomationCacheRequest *cacheRequest,
  [out, retval] IUIAutomationElement      **root
);

参数

[in] cacheRequest

类型: IUIAutomationCacheRequest*

指向缓存请求的指针,该请求指定要存储在缓存中的属性和控件模式。

[out, retval] root

类型: IUIAutomationElement**

接收指向 UI 自动化 元素的指针。

返回值

类型: HRESULT

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

注解

可以使用 FindAllFindFirst 方法将根元素用作查找其他元素的起点。

从根元素进行搜索时,请确保在搜索范围内指定 TreeScope_Children ,而不是 TreeScope_Descendants。 在桌面的整个子树中搜索可能会循环访问数千个项,并导致堆栈溢出。

要求

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

另请参阅

IUIAutomation

IUIAutomation::GetRootElement