简体   繁体   中英

Retrieve Patterns from UI Automation COM API

I have developed an application which uses the UI Automation managed library. The performance was very slow so I switched to using the UI Automation COM API with the wrapper: http://uiacomwrapper.codeplex.com/ .

I ran into a problem with one of the AutomationElements which used to return a ValuePattern no longer doing so. When I use UISpy I see that it does find the ValuePattern as well. Is this a problem with the API, wrapper? Is there anything I can do to get it working using the COM API. (I really don't want to go back to using the managed library)

Thanks

Can you see the value pattern using the current version of inspect32.exe? Inspect is from the Windows SDK, and shows either MSAA or UIA elements depending on mode. It's unmanaged, so will show a view consistent with using COM, while UISpy is managed. From what I remember, there are some differences between the managed and unmanaged versions. Do you know what type of UI (eg. winforms button, common control listview, etc) you are seeing this issue with?

My guess is to what's happening here is that the UltraGrid likely has a MSAA/IAccessible implementation. UIA attemptes to translate this into the appropriate UIA patterns - but the UIA support for this is slightly different in its managed vs unmanaged versions - notably the managed version is quite slow! In any case, the unmanaged version of UIA allows you to drill through to the underlying MSAA implementation - via that LegacyIAccessiblePattern - so you can get the values from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM