EventLogMsg

The EventLogMsg function logs an event to the event log, and, optionally, logs the original error(s) that caused the event.

Quick Info

Header file: EDKEVENT.H
Library: EDKEVENT.LIB
Unicode: Yes

VOID EventLogMsg(
  DWORD dwEvent,                             
  DWORD cStrings, {text string parameters},  
  DWORD cErrorCodes, {error code parameters}  
);
 

Parameters

dwEvent
Input parameter. Specifies the error code of the event to log.
cStrings
Input parameter. Specifies the number of text string parameters.
{text string parameters}
Input parameter. Specifies the text string parameters:
[LPTSTR pszString1]
[LPTSTR pszString2]
[...................]
[LPTSTR pszStringN]
cErrorCodes
Input parameter. Specifies the number of error code parameters.
{error code parameters}
Input parameter. Specifies the error code parameters:
[DWORD dwErrorCode1]
[DWORD dwErrorCode2]
[.....................]
[DWORD dwErrorCodeN]

Return Values

None.

Remarks

Each of these strings and error codes are used as parameters to the message in their order of appearance. This means that all of the error-message replacement parameters in event messages must have higher numbers than all of the string replacement parameters. For example:

EventLogMsg(MYAPP_CANNOT_COPY_FILE, 2, pszSourceFile, pszDestFile, 1, dwError);
 

The message would be defined as:

MessageId=
Severity=Error
Facility=Application
SymbolicName=MYAPP_CANNOT_COPY_FILE
Language=English
Cannot copy file from %1 to %2 due to the following error:%n%3.
 

The error code count and error code list are required after the text string count and text string list. Failure to include the error code argument(s) may cause unexpected results.

This routine preserves the last error value returned by the MAPI IMAPIProp::GetLastError method.

For information on the IMAPIProp::GetLastError method, see the MAPI Programmer's Reference.

See Also

HrEventCloseLog, HrEventGetCounts, HrEventGetHandle, HrEventOpenLog, HrEventUseExisting