IUIAutomationTreeWalker::GetParentElement 方法 (uiautomationclient.h)

检索指定UI 自动化元素的父元素。

语法

HRESULT GetParentElement(
  [in]          IUIAutomationElement *element,
  [out, retval] IUIAutomationElement **parent
);

参数

[in] element

类型: IUIAutomationElement*

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

[out, retval] parent

类型: IUIAutomationElement**

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

返回值

类型: HRESULT

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

注解

Microsoft UI 自动化树的结构会随着桌面上可见 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)