IUIAutomationTreeWalker::GetParentElementBuildCache 方法 (uiautomationclient.h)

检索指定 UI 自动化元素的父元素,并缓存属性和控件模式。

语法

HRESULT GetParentElementBuildCache(
  [in]          IUIAutomationElement      *element,
  [in]          IUIAutomationCacheRequest *cacheRequest,
  [out, retval] IUIAutomationElement      **parent
);

参数

[in] element

类型: IUIAutomationElement*

指向要为其检索父级的元素的指针。

[in] cacheRequest

类型: IUIAutomationCacheRequest*

指向缓存请求的指针,该请求指定要在返回的元素上缓存的属性和控件模式。

[out, retval] parent

类型: IUIAutomationElement**

接收指向父元素的指针;如果没有父元素,则为 NULL

返回值

类型: HRESULT

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

注解

随着桌面上可见 UI 元素的更改,Microsoft UI 自动化树的结构会发生变化。 不能保证作为父元素返回的元素会在后续传递中作为父元素返回。

要求

   
最低受支持的客户端 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)