Michael Bernstein Principal Software Design Engineer Microsoft Corporation
Accessibility Programmatic Access 2
3 UI Automation Core MSAA UIA Managed Client API UIA Provider API UIA COM Client API
Context: Clients and Providers Client-side API (C# or C++) Client Provider UIA Infrastructure UIA Provider-side interface definitions (C# or C++) Test Automation and Assistive Technology Manufacturers Application and Control Developers
TAKING ADVANTAGE OF THE NEW COM CLIENT API Client Provider UIA
SAMPLE: Querying a window’s password status CComPtr spAutomation; CComPtr spElement; HRESULT hr; hr = spAutomation.CoCreateInstance(CLSID_CUIAutomation); if (SUCCEEDED(hr)) { hr = spAutomation->GetFocusedElement(&spElement); if (SUCCEEDED(hr)) { BOOL isPassword; spElement->get_CurrentIsPassword(&isPassword); }
Automation Elements
Basic Properties UIA Control Type UI FrameworkFramework Specific Property UI Automation Property ButtonWindows Presentation Foundation ContentNameProperty ButtonWin32CaptionNameProperty ImageTrident/HTMLALTNameProperty
Control Patterns ComboBoxSimple Expand Collapse Value
Find Requests
Visiting the Relatives: TreeWalker List View ListItem1ListItem2Scroll Bar Up button Down button A sample control tree:
15
Accelerate your access: CacheRequests Define Create a request and add entries for properties and patterns you want cached Define filter and scope for caching Query Call the element’s BuildUpdatedCache method or “…BuildCache” methods A new copy with cached data is returned in one chunk Use Use ‘Cached’ flavor of property accessors to read cached data or patterns Children can be cached as well
Client Provider UIA
Client Provider UIA
ComboBox Simple ExpandCollapse Invoke Table Text Toggle Value Virtualized
Client Provider UIA Custom data
Client Provider UIA Custom Proxy Non-UIA channel
What about managed clients? UI Automation Core UIA Managed Client API UIA Provider API UIA COM Client API Your Client Code; TlbImport Wrapper
Managed client option #2: Use the existing managed library UI Automation Core UIA Managed Client API UIA Provider API UIA COM Client API Your Client Code
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.