Partager via


Client/Server Communication

The WinEvent mechanism provides a way for servers to communicate easily with Active Accessibility clients. Clients often collect information by reacting to WinEvents (for example, following focus), but they are free to request information from a server at any time.

To request information for an accessible object that generates a WinEvent, a client must process the event and establish a connection with the relevant accessible object. To do this, the client performs the following six steps:

  1. A server calls NotifyWinEvent to generate a WinEvent notification for each change to its user interface elements.
  2. The WinEvent management code in USER determines if any client applications have registered a WinEvent hook function using SetWinEventHook and calls the registered callback procedure.
  3. In its callback function, the client requests access to the object that generated the event by calling AccessibleObjectFromEvent or other accessible object retrieval functions. For more information, see Retrieving an IAccessible Object.
  4. This Active Accessibility API sends the server application a WM_GETOBJECT message to retrieve the accessible object.
  5. In response to WM_GETOBJECT, the server application either returns zero or returns a value that acts as a one-time reference to the object that generated the event.
  6. If the server returns zero, Active Accessibility creates a proxy object and gives its address to the client. Otherwise, Active Accessibility uses this reference to retrieve the address of an object interface such as IAccessible or IDispatch, and gives that address to the client.

Once the client has an interface address, it can call the IAccessible properties and methods of the accessible object to retrieve information.

For more information about the client/server communication, see the following topics: