共用方式為


Event Constants

The following section describes the events generated by the operating system and server applications. The constants are listed in ascending numeric order. Additionally, the EVENT_MIN constant represents the lowest possible event values, and the EVENT_MAX constant represents the highest possible event values.

Prior to using these events, client applications should use Accessible Event Watcher to verify that these events are used by user interface (UI) elements.

For more information about events in general, see What Are WinEvents? and System Level and Object Level Events. For more information about the events sent by the system, see Appendix A: Supported User Interface Elements Reference.

  • EVENT_SYSTEM_SOUND
    A sound has been played. The system sends this event when a system sound, such as one for a menu, is played even if no sound is audible (due to the lack of a sound file or sound card, for example). Servers send this event if a custom UI element generates a sound.

    For this event, the WinEventProc callback function receives the OBJID_SOUND value as the idObject parameter.

  • EVENT_SYSTEM_ALERT
    An alert has been generated. Server applications send this event when a user needs to know that a user interface element has changed. For more information, see Alerts.

    This event is not sent consistently by the system for dialog box objects. This is a known issue and is being addressed.

  • EVENT_SYSTEM_FOREGROUND
    The foreground window has changed. The system sends this event even if the foreground window has changed to another window in the same thread. Server applications never send this event.

    For this event, the WinEventProc callback function's hwnd parameter is the handle to the window that is in the foreground, and the idObject parameter is OBJID_WINDOW. The idChild parameter is CHILDID_SELF.

  • EVENT_SYSTEM_MENUSTART
    A menu item on the menu bar has been selected. The system sends this event for standard menus, identified by HMENU, created using menu-template resources or Microsoft Win32 menu APIs. Servers send this event for custom menus (user interface elements that function as menus but are not created in the standard way).

    For this event, the WinEventProc callback function's hwnd, idObject, and idChild parameters refer to the control that contains the menu bar or the control that activates the context menu. The hwnd parameter is the handle to the window related to the event. The idObject parameter is OBJID_MENU or OBJID_SYSMENU for a menu, or OBJID_WINDOW for a pop-up menu. The idChild parameter is CHILDID_SELF.

    The system triggers more than one EVENT_SYSTEM_MENUSTART event that does not always correspond with the EVENT_SYSTEM_MENUEND event.

  • EVENT_SYSTEM_MENUEND
    A menu from the menu bar has been closed. The system sends this event for standard menus. Servers send this event for custom menus.

    For this event, the WinEventProc callback function's hwnd, idObject, and idChild parameters refer to the control that contains the menu bar or the control that activates the context menu. The hwnd parameter is the handle to the window related to the event. The idObject parameter is OBJID_MENU or OBJID_SYSMENU for a menu, or OBJID_WINDOW for a pop-up menu. The idChild parameter is CHILDID_SELF.

  • EVENT_SYSTEM_MENUPOPUPSTART
    A pop-up menu has been displayed. The system sends this event for standard menus, identified by HMENU, created using menu-template resources or Win32 menu APIs. Servers send this event for custom menus (user interface elements that function as menus but are not created in the standard way).

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_SYSTEM_MENUPOPUPEND
    A pop-up menu has been closed. The system sends this event for standard menus. Servers send this event for custom menus.

    When a pop-up menu is closed, the client receives this message followed by the EVENT_SYSTEM_MENUEND event.

    This event is not sent consistently by the system. This is a known problem and is being addressed.

  • EVENT_SYSTEM_CAPTURESTART
    A window has received mouse capture. This event is sent by the system; servers never send this event.

  • EVENT_SYSTEM_CAPTUREEND
    A window has lost mouse capture. This event is sent by the system; servers never send this event.

  • EVENT_SYSTEM_MOVESIZESTART
    A window is being moved or resized. This event is sent by the system; servers never send this event.

  • EVENT_SYSTEM_MOVESIZEEND
    The movement or resizing of a window has finished. This event is sent by the system; servers never send this event.

  • EVENT_SYSTEM_CONTEXTHELPSTART
    A window has entered context-sensitive Help mode.

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_SYSTEM_CONTEXTHELPEND
    A window has exited context-sensitive Help mode.

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_SYSTEM_DRAGDROPSTART
    An application is about to enter drag-and-drop mode. Applications that support drag-and-drop operations must send this event; the system does not send this event.

  • EVENT_SYSTEM_DRAGDROPEND
    An application is about to exit drag-and-drop mode. Applications that support drag-and-drop operations must send this event; the system does not send this event.

  • EVENT_SYSTEM_DIALOGSTART
    A dialog box has been displayed. This event is sent by the system for standard dialog boxes, created using resource templates or Win32 dialog box APIs. Servers send this event for custom dialog boxes (windows that function as dialog boxes but are not created in the standard way).

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_SYSTEM_DIALOGEND
    A dialog box has been closed. This event is sent by the system for standard dialog boxes. Servers send this event for custom dialog boxes.

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_SYSTEM_SCROLLINGSTART
    Scrolling has started on a scroll bar. This event is sent by the system for scroll bars attached to a window and for standard scroll bar controls. Servers send this event for custom scroll bars (user interface elements that function as scroll bars but are not created in the standard way).

    The idObject parameter sent to the WinEventProc callback function is OBJID_HSCROLL for horizontal scrolls bars or OBJID_VSCROLL for vertical scroll bars.

  • EVENT_SYSTEM_SCROLLINGEND
    Scrolling has ended on a scroll bar. This event is sent by the system for scroll bars attached to a window and for standard scroll bar controls. Servers send this event for custom scroll bars.

    The idObject parameter sent to the WinEventProc callback function is OBJID_HSCROLL for horizontal scroll bars or OBJID_VSCROLL for vertical scroll bars.

  • EVENT_SYSTEM_SWITCHSTART
    The user has pressed ALT+TAB, which activates the switch window. This event is sent by the system; servers never send this event. The hwnd parameter of the WinEventProc callback function identifies the window the user is switching to.

    If only one application is running when the user presses ALT+TAB, the system sends an EVENT_SYSTEM_SWITCHEND event without a corresponding EVENT_SYSTEM_SWITCHSTART event.

  • EVENT_SYSTEM_SWITCHEND
    The user has released ALT+TAB. This event is sent by the system; servers never send this event. The hwnd parameter of the WinEventProc callback function identifies the window the user has switched to.

    If only one application is running when the user presses ALT+TAB, the system sends this event without a corresponding EVENT_SYSTEM_SWITCHSTART event.

  • EVENT_SYSTEM_MINIMIZESTART
    A window object is about to be minimized or maximized. This event is sent by the system; servers never send this event.

  • EVENT_SYSTEM_MINIMIZEEND
    A window object has been minimized or maximized. This event is sent by the system; servers never send this event.

  • EVENT_SYSTEM_DESKTOPSWITCH
    The active desktop has been switched.

  • EVENT_OBJECT_CREATE
    An object has been created. The system sends this event for the following user interface elements: caret, header control, list view control, tab control, toolbar control, tree view control, and window object. Server applications send this event for their accessible objects.

    Servers must send this event for all of an object's child objects before sending the event for the parent object. Servers must ensure that all child objects are fully created and ready to accept IAccessible calls from clients when the parent object sends this event.

    Because a parent object is created after its child objects, clients must make sure that an object's parent has been created before calling IAccessible::get_accParent, particularly if in-context hook functions are used.

  • EVENT_OBJECT_DESTROY
    An object has been destroyed. The system sends this event for the following user interface elements: caret, header control, list view control, tab control, toolbar control, tree view control, and window object. Server applications send this event for their accessible objects.

    Clients assume that all of an object's children are destroyed when the parent object sends this event.

    Clients do not call an object's IAccessible properties or methods after receiving this event because the interface pointer is no longer valid. Servers prevent this situation by creating proxy objects that wrap accessible objects and monitor the life span of those objects.

  • EVENT_OBJECT_SHOW
    A hidden object is shown. The system sends this event for the following user interface elements: caret, cursor, and window object. Server applications send this event for their accessible objects.

    Clients assume that when this event is sent by a parent object, all child objects are already displayed. Therefore, server applications do not send this event for the child objects.

    Hidden objects include the STATE_SYSTEM_INVISIBLE flag; shown objects do not include this flag. The EVENT_OBJECT_SHOW event also indicates that the STATE_SYSTEM_INVISIBLE flag is cleared. Therefore, servers do not send the EVENT_STATE_CHANGE event in this case.

  • EVENT_OBJECT_HIDE
    An object is hidden. The system sends this event for the following user interface elements: caret and cursor. Server applications send this event for their accessible objects.

    When this event is generated for a parent object, all child objects are already hidden. Server applications do not send this event for the child objects.

    Hidden objects include the STATE_SYSTEM_INVISIBLE flag; shown objects do not include this flag. The EVENT_OBJECT_HIDE event also indicates that the STATE_SYSTEM_INVISIBLE flag is set. Therefore, servers do not send the EVENT_STATE_CHANGE event in this case.

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_OBJECT_REORDER
    A container object has added, removed, or reordered its children. The system sends this event for the following user interface elements: header control, list view control, toolbar control, and window object. Server applications send this event as appropriate for their accessible objects.

    For example, this event is generated by a list view object when the number of child elements or the order of the elements changes. This event is also sent by a parent window when the z order for the child windows changes.

  • EVENT_OBJECT_INVOKED
    An object has been invoked; for example, the user has clicked a button. This event is supported by common controls and is used by Microsoft UI Automation.

  • EVENT_OBJECT_FOCUS
    An object has received the keyboard focus. The system sends this event for the following user interface elements: list view control, menu bar, pop-up menu, switch window, tab control, tree view control, and window object. Server applications send this event for their accessible objects.

    The hwnd parameter of the WinEventProc callback function identifies the window that receives the keyboard focus.

  • EVENT_OBJECT_SELECTION
    The selection within a container object has changed. The system sends this event for the following user interface elements: list view control, tab control, tree view control, and window object. Server applications send this event for their accessible objects.

    This event signals a single selection: either a child is selected in a container that previously did not contain any selected children, or the selection has changed from one child to another.

    The hwnd and idObject parameters of the WinEventProc callback function describe the container. The idChild parameter identifies the object that is selected. The idChild parameter is OBJID_WINDOW if the selected child is a window that also contains objects.

  • EVENT_OBJECT_SELECTIONADD
    An item within a container object has been added to the selection. The system sends this event for the following user interface elements: list box, list view control, and tree view control. Server applications send this event for their accessible objects.

    This event signals that a child is added to an existing selection.

    The hwnd and idObject parameters of the WinEventProc callback function describe the container. The idChild parameter is the child added to the selection.

  • EVENT_OBJECT_SELECTIONREMOVE
    An item within a container object has been removed from the selection. The system sends this event for the following user interface elements: list box, list view control, and tree view control. Server applications send this event for their accessible objects.

    This event signals that a child is removed from an existing selection.

    The hwnd and idObject parameters of the WinEventProc callback function describe the container. The idChild parameter identifies the child removed from the selection.

  • EVENT_OBJECT_SELECTIONWITHIN
    Numerous selection changes have occurred within a container object. The system sends this event for list boxes. Server applications send this event for their accessible objects.

    This event is sent when the selected items within a control have changed substantially. This event informs the client that many selection changes have occurred, and is used instead of sending several EVENT_OBJECT_SELECTIONADD or EVENT_OBJECT_SELECTIONREMOVE events. The client queries for the selected items by calling the container object's IAccessible::get_accSelection method and enumerating the selected items.

    For this event notification, the hwnd and idObject parameters of the WinEventProc callback function describe the container in which the changes occurred.

  • EVENT_OBJECT_TEXTSELECTIONCHANGED
    An object's text selection has changed. This event is supported by common controls and used by UI Automation.

  • EVENT_OBJECT_CONTENTSCROLLED
    A window object's scrolling has ended. Unlike EVENT_SYSTEM_SCROLLEND, this event is associated with the scrolling window. There is no difference between horizontal or vertical scrolling. This event should be sent whenever the scroll action is completed.

  • EVENT_OBJECT_STATECHANGE
    An object's state has changed. The system sends this event for the following user interface elements: check box, combo box, header control, push button, radio button, scroll bar, toolbar control, tree view control, up-down control, and window object. Server applications send this event for their accessible objects.

    For example, a state change occurs when a button object is pressed or released, or when an object is enabled or disabled.

    For this event notification, the idChild parameter of the WinEventProc callback function identifies the child object whose state has changed.

    This event is not sent consistently by the system. This is a known issue and is being addressed.

  • EVENT_OBJECT_LOCATIONCHANGE
    An object has changed location, shape, or size. The system sends this event for the following user interface elements: caret and window object. Server applications send this event for their accessible objects.

    This event is generated in response to the top-level object within the object hierarchy that has changed, not for any children it might contain. For example, if the user resizes a window, the system sends this notification for the window, but not for the menu bar, title bar, scroll bars, or other objects that have also changed.

    The system does not send this event for every non-floating child window when the parent moves. However, if an application explicitly resizes child windows as a result of resizing, the system sends multiple events for the resized children.

    If an object's State property is set to STATE_SYSTEM_FLOATING, servers sends EVENT_OBJECT_LOCATIONCHANGE whenever the object changes location. If an object does not have this state, servers only trigger this event when the object moves relative to its parent.

    For this event notification, the idChild parameter of the WinEventProc callback function identifies the child object that changed.

  • EVENT_OBJECT_NAMECHANGE
    An object's Name property has changed. The system sends this event for the following user interface elements: check box, cursor, list view control, push button, radio button, status bar control, tree view control, and window object. Server applications send this event for their accessible objects.

  • EVENT_OBJECT_DESCRIPTIONCHANGE
    An object's Description property has changed. Server applications send this event for their accessible objects.

  • EVENT_OBJECT_VALUECHANGE
    An object's Value property has changed. The system sends this event for the following user interface elements: edit control, header control, hot key control, progress bar control, scroll bar, slider control, and up-down control. Server applications send this event for their accessible objects.

  • EVENT_OBJECT_PARENTCHANGE
    An object has a new parent object. Server applications send this event for their accessible objects.

  • EVENT_OBJECT_HELPCHANGE
    An object's Help property has changed. Server applications send this event for their accessible objects.

  • EVENT_OBJECT_DEFACTIONCHANGE
    An object's DefaultAction property has changed. The system sends this event for dialog boxes. Server applications send this event for their accessible objects.

  • EVENT_OBJECT_ACCELERATORCHANGE
    An object's KeyboardShortcut property has changed. Server applications send this event for their accessible objects.