Share via


Retrieving an IAccessible Object

Microsoft Active Accessibility provides application programming interfaces (APIs) 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 APIs that retrieve an interface to an object, 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 for the element. To retrieve an element's IAccessible object, clients can use one of the AccessibleObjectFromX APIs:

  • AccessibleObjectFromPoint
  • AccessibleObjectFromWindow
  • AccessibleObjectFromEvent

To retrieve an IAccessible Interface Pointer

  1. Client calls AccessibleObjectFromX.

  2. OLEACC 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 proxy,

    Or

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

    1. Constructs an IAccessible object for the element.
    2. Calls LresultFromObject to marshal the object's pointer.
    3. Returns the LRESULT to OLEACC.
  5. OLEACC examines the return value from WM_GETOBJECT.
    If it is zero, OLEACC constructs a proxy object and returns it to the client.

    Or

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