Generating Appropriate WinEvents
Server developers need to ensure that appropriate WinEvents are generated for all UI elements, including window-based UI elements, windowless UI elements, and UI elements with highly customized behaviors.
USER provides default WinEvent support for standard, HWND-based UI elements. Because USER generates these events automatically, servers need to generate events only for custom controls, windowless elements, or controls whose events are not already generated by USER.
To send an event, servers call NotifyWinEvent and pass the event constant, an object ID, and the HWND for a window that can respond to client requests for more information. The events that need to be fired vary according to the type of UI element. There are general events that should be sent for all controls, and specific events that should be sent only for the appropriate UI element.
General Events
General WinEvents can be sent for all UI elements. These include:
- EVENT_OBJECT_CREATE (when an object is created)
- EVENT_OBJECT_DESTROY (when an object is destroyed)
- EVENT_OBJECT_SHOW (when an object is shown)
- EVENT_OBJECT_HIDE (when an object is hidden)
Specific Events
There are also specific WinEvents that can be sent for a particular type of UI element. For example, use EVENT_OBJECT_SELECTION for controls that allow the user to make a selection, such as a list box.
For more information about which events are expected for a particular type of UI element, see the following resources:
- Appendix A: Supported User Interface Elements Reference. This appendix includes information about system-generated UI elements that are exposed by Microsoft Active Accessibility. Documentation for each control includes information about events that can be generated by the UI element.
- Event Constants. This topic includes information about events generated by the operating system and server applications.
- Accessible Event Watcher (AccEvent.exe). This tool shows which events USER sends for a particular UI element. You can use this tool to learn which events you can expect for a UI element. For more information, see Accessible Event Watcher.