How Active Accessibility Works
Microsoft Active Accessibility is designed to help accessibility aids, called clients, interact with standard and custom user interface (UI) elements of other applications and the operating system. An Active Accessibility client is any program that uses Active Accessibility to access, identify, or manipulate the UI elements of an application. Clients include accessibility aids, automated testing tools, and some computer-based training applications.
Using Active Accessibility, a client application can:
- Query for information for example, about a UI element at a particular location.
- Receive notifications when information changes for example, when a control becomes grayed or when a text string changes.
- Carry out actions that affect user interface or document contents for example, click a push button, drop down a menu, and choose a menu command.
The applications that interact with and provide information for clients are called servers. A server uses Active Accessibility to provide information about its UI elements to clients. Any control, module, or application that uses Active Accessibility to expose information about its user interface is considered an Active Accessibility server. Servers communicate with clients by sending event notifications (such as calling NotifyWinEvent) and responding to client requests for access to UI elements (such as handling WM_GETOBJECT messages sent from OLEACC). Servers expose information through the IAccessible interface.
Using Active Accessibility, a server application can:
- Provide information about its custom user interface objects and the contents of its client windows.
- Send notifications when its user interface changes.
For example, to enable a user to select commands verbally from a word processor's custom toolbar, a speech recognition program must have information about that toolbar. The word processor would therefore need to make that information available. Active Accessibility provides the means for the word processor to expose information about its custom toolbar and for the speech recognition program to get that information.
An Active Accessibility client must be notified when the server's UI has changed so that it can convey that information to the user. To ensure that the client is informed about UI changes, it uses a mechanism called Window Events, or WinEvents, to register to receive notifications. For more information, see WinEvents .
To learn about and manipulate a particular UI element, clients use the Active Accessibility COM interface, IAccessible.
A client can retrieve an IAccessible object for a UI element in the following four ways:
- Call AccessibleObjectFromWindow and pass the UI element's window handle.
- Call AccessibleObjectFromPoint and pass a screen location that lies within the UI element's bounding rectangle.
- Set a WinEvent hook, receive a notification, and call AccessibleObjectFromEvent to retrieve an IAccessible interface pointer for the UI element that generated the event.
- Call an IAccessible method such as accNavigate or get_accParent to move to a different IAccessible object.