[This is preliminary documentation and subject to change.]
Server applications generate event notifications ("WinEvents") whenever they've done something that might be of interest to a client. Client applications don't automatically receive event notifications, they must request them.
Client applications tell the system about the event notifications they want to know about by registering a hook procedure with the SetWinEventHook function. Using this function, the client sets one or more hook functions that the system calls in response to particular events. Hook functions can be located within the client's code body, in a dynamic-link library (DLL) mapped into the client's process, or in a DLL mapped into the server's process. Each of these has benefits and drawbacks. For more information, see About the WinEventProc Callback Function.
The event notification process begins when a server calls the NotifyWinEvent function to inform the system that something of interest is occurring. Active Accessibility checks to see if any client applications have expressed interest in the event, and calls the appropriate hook procedures as necessary. When it is called, a hook procedure in the client can then receive a number of parameters that describe an event and the object that generated it. The hook procedure uses Active Accessibility system functions, like AccessibleObjectFromEvent, to gain access to the object of interest. Once the client retrieves the object, it can retrieve its properties, make selections, or perform other actions appropriate to the event.