To retrieve LegacyIAccessible information using UiAutomation, you can use the following steps:
Create a UiAutomation object by calling the static method "UiAutomation.GetInstance()" on the UiAutomation class.
Get the root element of the desktop by calling the "UiAutomation.RootElement" property on the UiAutomation object.
Get the list of all child elements of the root element by calling the "FindAll(TreeScope.Children, Condition.TrueCondition)" method on the root element.
Go through each child element in the list and check if it supports the "LegacyIAccessible" pattern by calling the "GetCurrentPattern(LegacyIAccessiblePattern.Pattern)" method on the element.
If the element supports the "LegacyIAccessible" pattern, get the "LegacyIAccessible" object by casting the result of "GetCurrentPattern(LegacyIAccessiblePattern.Pattern)" to a "LegacyIAccessiblePattern" object.
Retrieve the information about the element using the methods of the "LegacyIAccessiblePattern" object, such as "GetChildId", "GetName", and "GetRole".
Please start posting anonymously - your entry will be published after you log in or create a new account.
This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss