Export (0) Print
Expand All

NotifyWinEvent

The NotifyWinEvent function signals the system that a predefined event occurred. If any client applications have registered a hook function for the event, the system calls the client's hook function.

void WINAPI NotifyWinEvent(
  DWORD event,
  HWND hwnd,
  LONG idObject,
  LONG idChild
);

Parameters

event
[in] Specifies the event that occurred. This value must be one of the event constants.
hwnd
[in] Handle to the window that contains the object that generated the event.
idObject
[in] Identifies the kind of object that generated the event. This value is one of the predefined object identifiers or a custom object ID value.
idChild
[in] Identifies whether the event was generated by an object or by a child element of the object. If this value is CHILDID_SELF, the event was generated by the object itself. If not, this value is the child ID of the element that generated the event.

Remarks

Servers call this function to notify the system that an event has occurred. Active Accessibility checks to see if any client applications have set hook procedures for the event and, if so, calls the appropriate hook procedures.

If no hook procedures are registered for the event, the performance penalty for calling this function is minor.

Servers call NotifyWinEvent to announce the event to the system after the event has occurred; they must never notify the system of an event before the event has occurred.

When the client's hook procedure is called, it receives a number of parameters that describe the event and the object that generated the event. The hook procedure uses the AccessibleObjectFromEvent function to retrieve a pointer to the IAccessible interface of the object that generated the event.

Servers may receive a WM_GETOBJECT message immediately after calling this API. This can happen if there are any in-context clients that call AccessibleObjectFromEvent in the event callback.

When servers call this API, they must be ready to handle WM_GETOBJECT, return an IAccessible interface pointer, and handle any of the IAccessible methods.

Note to Server Developers  When you call NotifyWinEvent, if any clients are listening for that event in-context, their event handlers, which typically send WM_GETOBJECT and call IAccessible methods, will execute before NotifyWinEvent returns. When you call NotifyWinEvent, you should be prepared to handle these calls, if they occur. If you need to do extra setup to allow for this, you should do so before you call NotifyWinEvent, not after.

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.
  Library: Use User32.lib.

See Also

AccessibleObjectFromEvent, SetWinEventHook, UnHookWinEvent, WinEvents

Community Additions

Show:
© 2014 Microsoft