共用方式為


WinEventProc Callback Function

The WinEventProc function is an application-defined callback (or hook) function that the system calls in response to events generated by an accessible object. The hook function processes the event notifications as required. Clients install the hook function and request specific types of event notifications by calling SetWinEventHook.

The WINEVENTPROC type defines a pointer to this callback function. WinEventProc is a placeholder for the application-defined function name.

VOID CALLBACK WinEventProc(
HWINEVENTHOOKhWinEventHook,DWORDevent,HWNDhwnd,LONGidObject,LONGidChild,DWORDdwEventThread,DWORDdwmsEventTime);

Parameters

  • hWinEventHook
    Handle to an event hook function. This value is returned by SetWinEventHook when the hook function is installed and is specific to each instance of the hook function.
  • event
    Specifies the event that occurred. This value is one of the event constants.
  • hwnd
    Handle to the window that generates the event, or NULL if no window is associated with the event. For example, the mouse pointer is not associated with a window.
  • idObject
    Identifies the object associated with the event. This is one of the object identifiers or a custom object ID.
  • idChild
    Identifies whether the event was triggered by an object or a child element of the object. If this value is CHILDID_SELF, the event was triggered by the object; otherwise, this value is the child ID of the element that triggered the event.
  • dwEventThread
    Identifies the thread that generated the event, or the thread that owns the current window.
  • dwmsEventTime
    Specifies the time, in milliseconds, that the event was generated.

Remarks

Within the hook function, the parameters hwnd, idObject, and idChild are used when calling AccessibleObjectFromEvent.

Servers generate events by calling NotifyWinEvent.

Create multiple callback functions to handle different events. For more information, see Registering a Hook Function.

Example

For an example implementation, see SetWinEventHook.

Requirements

**  Windows NT/2000/XP/Server 2003:** Included in Windows 2000 and later.
**  Windows 95/98/Me:** Included in Windows 98 and later.
**  Redistributable:** Requires Active Accessibility 1.3 RDK on Windows NT 4.0 SP6 and Windows 95.
**  Header:** Declared in Winuser.h; include Windows.h.

See Also

SetWinEventHook, WINEVENTPROC