Getting an Accessible Object Interface Pointer

Microsoft Active Accessibility client applications retrieve interface pointers to accessible objects by using one of the following functions.

AccessibleObjectFromEvent

Many clients look up information about specific accessible objects that generate events. Because the IAccessible interface is the "gateway" to accessible objects, clients must have an easy way to associate WinEvents with the IAccessible interface of the object generating the events. Microsoft Active Accessibility provides the AccessibleObjectFromEvent function specifically for this purpose.

Note

Clients with in-context hook functions must call the IsWindow function before calling AccessibleObjectFromEvent.

 

The AccessibleObjectFromEvent function accepts much of the same information that a client's hook function receives. When a client hook function receives an event notification, it passes the appropriate parameters from events to AccessibleObjectFromEvent.

The function retrieves either the IAccessible interface of the user interface element that generated the event or the interface of the element's parent object. If the parent object's interface pointer is returned, the client calls the parent's properties and methods to obtain information about the child element that generated the event.

AccessibleObjectFromPoint

To retrieve the address of an object's IAccessible interface at a specified point on the screen, clients use the AccessibleObjectFromPoint function.

AccessibleObjectFromWindow

To retrieve an object's IAccessible interface from a window handle, clients use the AccessibleObjectFromWindow function.

It is possible that servers return distinct interface pointers for the same user interface element each time the AccessibleObjectFromEvent, AccessibleObjectFromPoint, or AccessibleObjectFromWindow function is called. To determine if two pointers refer to the same user interface element, client developers must compare IAccessible properties of the object, not pointers.