log message
Hello,
I have in my code the following,
and I have got error message on ReportEvent :
cannot convert parameter 8 from 'char *[2]' to 'const char ** '
Ho can I fix the problem ?
VOID AddToMessageLog(LPTSTR lpszMsg)
{
TCHAR szMsg[256];
HANDLE hEventSource;
LPTSTR lpszStrings[2];
char szServiceName[512];
char szPath[512];
GetModuleFileName(NULL, szPath, 512);
ExtractFileName(szPath, szServiceName);
if ( !bDebug )
{
dwErr = GetLastError();
// Use event logging to log the error.
//
hEventSource = RegisterEventSource(NULL, TEXT(szServiceName));
_stprintf(szMsg, TEXT("%s error: %d"), TEXT(szServiceName), dwErr);
lpszStrings[0] = szMsg; lpszStrings[1] = lpszMsg;
if (hEventSource != NULL)
{
ReportEvent(hEventSource, // handle of event source
EVENTLOG_ERROR_TYPE, // event type
0, // event category
0, // event ID
NULL, // current user's SID
2, // strings in lpszStrings
0, // no bytes of raw data
lpszStrings, // array of error strings
NULL); // no raw data
(VOID) DeregisterEventSource(hEventSource);
}
}
}