NotifyChangeEventLog function (winbase.h)

Enables an application to receive notification when an event is written to the specified event log. When the event is written to the log, the specified event object is set to the signaled state.

Syntax

BOOL NotifyChangeEventLog(
  [in] HANDLE hEventLog,
  [in] HANDLE hEvent
);

Parameters

[in] hEventLog

A handle to an event log. The OpenEventLog function returns this handle.

[in] hEvent

A handle to a manual-reset or auto-reset event object. Use the CreateEvent function to create the event object.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The NotifyChangeEventLog function does not work with remote handles. If the hEventLog parameter is the handle to an event log on a remote computer, NotifyChangeEventLog returns zero, and GetLastError returns ERROR_INVALID_HANDLE.

If the thread is not waiting on the event when the system calls PulseEvent, the thread will not receive the notification. Therefore, you should create a separate thread to wait for notifications.

The system will continue to notify you of changes until you close the handle to the event log. To close the event log, use the CloseEventLog or DeregisterEventSource function.

Examples

For an example, see Receiving Event Notification.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Advapi32.lib
DLL Advapi32.dll
API set ext-ms-win-advapi32-eventlog-l1-1-1 (introduced in Windows 10, version 10.0.10240)

See also

CloseEventLog

CreateEvent

DeregisterEventSource

Event Logging Functions

OpenEventLog