thanks Ganesh
I resolved my problem using following. Following code write the logs sucessfully in Event log Viewer.
int grades [] =
{
EVENTLOG_SUCCESS,
EVENTLOG_INFORMATION_TYPE,
EVENTLOG_WARNING_TYPE,
EVENTLOG_ERROR_TYPE,
};
// Use event logging to log the error.
//
static HANDLE hEventSource = NULL;
if ( hEventSource == NULL ) hEventSource = RegisterEventSource(NULL, TEXT("Agrando_ISAPI"));
LPTSTR lpszStrings[1];
lpszStrings[0] = "My test Message to check in Event Viewer";
if (hEventSource != NULL) {
bool a = ReportEvent(hEventSource, // handle of event source
grades[0], // event type
0, // event category
1, // event ID
NULL, // current user's SID
1, // strings in lpszStrings
0, // no bytes of raw data
(const char**)lpszStrings, // array of error strings
NULL); // no raw data
//(VOID) DeregisterEventSource(hEventSource);
}