OpenEventLogW function (winbase.h)
Opens a handle to the specified event log.
HANDLE OpenEventLogW( [in] LPCWSTR lpUNCServerName, [in] LPCWSTR lpSourceName );
The Universal Naming Convention (UNC) name of the remote server on which the event log is to be opened. If this parameter is NULL, the local computer is used.
The name of the log.
If you specify a custom log and it cannot be found, the event logging service opens the Application log; however, there will be no associated message or category string file.
If the function succeeds, the return value is the handle to an event log.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
To close the handle to the event log, use the CloseEventLog function.
For an example, see Querying for Event Information.
The winbase.h header defines OpenEventLog as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||winbase.h (include Windows.h)|
|API set||ext-ms-win-advapi32-eventlog-ansi-l1-1-0 (introduced in Windows 10, version 10.0.10240)|