IUIAutomationTreeWalker::GetNextSibling Method

Retrieves the next sibling element of the specified UI Automation element, and caches properties and control patterns.


HRESULT GetNextSibling(          IUIAutomationElement *element,
    IUIAutomationCacheRequest *cacheRequest,
    IUIAutomationElement **next


[in] The address of the IUIAutomationElement interface of the element for which to retrieve the next sibling.
[in] The address of the IUIAutomationCacheRequest interface for a cache request that specifies the properties and patterns to cache on the returned element.
[out, retval] The address of a variable that receives a pointer to the IUIAutomationElement interface of the next sibling element, or NULL if there is no sibling element.

Return Value

Returns S_OK if successful, or an error value otherwise.


An element can have additional sibling elements that do not match the current view condition and thus are not returned when navigating the element tree.

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 next sibling element will be returned as the next sibling on subsequent passes.

Community Additions