IUIAutomationTreeWalker::GetParentElement Method

Retrieves the parent element of the specified UI Automation element.

Syntax

HRESULT GetParentElement(      
    IUIAutomationElement *element,
    IUIAutomationElement **parent
);

Parameters

  • element
    [in] The address of the IUIAutomationElement interface of the element for which to retrieve the parent.
  • parent
    [out, retval] The address of a variable that receives a pointer to the IUIAutomationElement interface of parent element, or NULL if there is no parent element.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The structure of the Microsoft UI Automation tree changes as the visible UI elements on the desktop change. It is not guaranteed that an element returned as the parent element will be returned as the parent on subsequent passes.