IUIAutomationTreeWalker::Normalize Method

Retrieves the ancestor element nearest to the specified Microsoft UI Automation element in the tree view.

Syntax


HRESULT Normalize(          IUIAutomationElement *element,
    IUIAutomationElement **normalized
);

Parameters

element
[in] The address of the IUIAutomationElement interface of the element from which to start the normalization.
normalized
[out, retval] The address of a variable that receives a pointer to the IUIAutomationElement interface of the ancestor element nearest to the specified element in the tree view.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The element is normalized by navigating up the ancestor chain in the tree until an element that satisfies the view condition (specifed by a previous call to IUIAutomationTreeWalker::Condition) is reached. If the root element is reached, the root element is returned, even if it does not satisfy the view condition.

This method is useful for applications that obtain references to UI Automation elements by hit-testing. The application might want to work only with specific types of elements, and can use IUIAutomationTreeWalker::Normalize to make sure that no matter what element is initially retrieved (for example, when a scroll bar gets the input focus), only the element of interest (such as a content element) is ultimately retrieved.

Community Additions

Show: