Retrieving an IAccessible Object

Microsoft Active Accessibility provides functions such as AccessibleObjectFromWindow and AccessibleObjectFromPoint that allow clients to retrieve accessible objects. These functions return either an IDispatch or IAccessible interface pointer through which clients get information about the accessible object.

When a client calls AccessibleObjectFromWindow or any of the other AccessibleObjectFromX functions that retrieve an interface to an object, Microsoft Active Accessibility sends the WM_GETOBJECT window message to the applicable window procedure within the appropriate application. To provide information to clients, servers must respond to the WM_GETOBJECT message.

To collect specific information about a UI element, clients must first retrieve an IAccessible interface for the element. To retrieve an element's IAccessible object, clients can use one of the following functions:

To retrieve an IAccessible Interface Pointer

  1. Client calls one of the AccessibleObjectFromX functions.

  2. Oleacc.dll sends a WM_GETOBJECT message to server.

  3. The server determines which UI element corresponds to the request.

  4. The server either returns zero to request an Oleacc.dll proxy,

    Or

    Returns an IAccessible object (native implementation). To do this, it:

    • Constructs an IAccessible object for the element.
    • Calls LresultFromObject to marshal the object's pointer.
    • Returns the LRESULT to Oleacc.dll.
  5. Oleacc.dll examines the return value from WM_GETOBJECT.

    If it is zero, Oleacc.dll constructs a proxy object and returns it to the client.

    Or

    If it is nonzero, Oleacc.dll calls ObjectFromLresult to unmarshal the native IAccessible object pointer and returns it to the client.