The New COM API for Accessibility and Automation in .ppt
《The New COM API for Accessibility and Automation in .ppt》由会员分享,可在线阅读,更多相关《The New COM API for Accessibility and Automation in .ppt(35页珍藏版)》请在麦多课文档分享上搜索。
1、The New COM API for Accessibility and Automation in Windows 7, Michael BernsteinPrincipal Software Design EngineerMicrosoft Corporation,Programmatic UI Access: A Key Element of Accessibility,Enables developers to write code that: Navigates between UI elements Gathers information about the UI Interac
2、ts with UI elements Receives notifications when the UI changes,2,UI Automation (UIA): Programmatic Access in Windows,Successor to Microsoft Active Accessibility (MSAA) Creates a universal object model for accessing UI Designed based on experience with MSAA usage Supported on Windows Vista, XP and Se
3、rver 2003 UIA COM Client API introduced in Windows 7,3,UI Automation Core,MSAA,UIA Managed Client API,UIA Provider API,UIA COM Client API,Whats new in Windows 7?,UIA Clients can now use COM instead of managed code New Accessibility properties are available Native clients can register custom proxies
4、to make existing UI more accessible Developers can define custom Accessibility properties and events beyond the official UIA list,Inspecting UIA Properties,demo,Context: Clients and Providers,Client-side API (C# or C+),Client,Provider,UIA Infrastructure,UIA,Provider-side interface definitions (C# or
5、 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 windows password status,CComPtr spAutomation; CComPtr spElement; HRESULT hr; hr = spAutomation.CoCreateInstance(CLSID_CUIAu
6、tomation); if (SUCCEEDED(hr) hr = spAutomation-GetFocusedElement( ,Automation Elements,Just as in the managed API, an automation element represents a piece of UI, regardless of underlying implementation First, create an instance of CUIAutomation, the factory for the object model Next, get an element
7、: From an HWND: ElementFromHandle From a Point: ElementFromPoint From current focus: GetFocusedElement Each method returns an IUIAutomationElement,Basic Properties,IUIAutomationElement exposes properties that make sense for elements in general Properties are exposed in COM manner and are consistent
8、across all underlying UI,Three Key Properties,NameProperty String that a user would use to explain which control was being referred to (Customer: Accessibility Tools) ControlTypeProperty Primary identifier for what type of control the automation element represents. (Customers: Both) AutomationIdProp
9、erty String that uniquely identifies an element among its siblings in the tree (Customer: Test Automation),Control Patterns,Control Patterns allow access to a controls particular abilities InvokePattern: Push Me TransformPattern: Move Me ScrollPattern: Scroll Me SelectionItemPattern: Select Me Patte
10、rns can contain properties, methods and events,Find Requests,Find requests allow you to locate elements based on conditions Conditions are based on property matching They can include Boolean operators as well Requests can be restricted by scope Find can return the first match or all matches Faster a
11、lternative to manual searching,Visiting the Relatives: TreeWalker,All UIA elements are organized into a tree TreeWalkers allow navigation around the tree GetParentElement, GetFirstChildElement, GetNextSiblingElement, etc. Can filter by condition,A sample control tree:,Consuming Events,Enable clients
12、 to be notified when changes occur in the UI Client implements a listener interface Register your listener with CUIAutomation Clients can scope what parts of automation tree to listen for events on Applicable events are always associated with a reference to automation element where change occurredht
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- THENEWCOMAPIFORACCESSIBILITYANDAUTOMATIONINPPT

链接地址:http://www.mydoc123.com/p-373309.html