NotifyWinEvent function (winuser.h)

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.

Syntax

void NotifyWinEvent(
  [in] DWORD event,
  [in] HWND  hwnd,
  [in] LONG  idObject,
  [in] LONG  idChild
);

Parameters

[in] event

Type: DWORD

Specifies the event that occurred. This value must be one of the event constants.

[in] hwnd

Type: HWND

Handle to the window that contains the object that generated the event.

[in] idObject

Type: LONG

Identifies the object that generated the event. This value is either one of the predefined object identifiers or a custom object ID value.

[in] idChild

Type: LONG

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 CHILDID_SELF, this value is the child ID of the element that generated the event.

Return value

None

Remarks

Servers call this function to notify the system that an event has occurred. Microsoft 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 function. This can happen if there are any in-context clients that call AccessibleObjectFromEvent in the event callback.

When servers call this function, 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

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
Redistributable Active Accessibility 1.3 RDK on Windows NT 4.0 with SP6 and later and Windows 95
API set ext-ms-win-ntuser-server-l1-1-0 (introduced in Windows 8)

See also

AccessibleObjectFromEvent

SetWinEventHook

UnHookWinEvent

WinEvents