• C

Writing to NT Event Log

I have written a Win32 service in C and am interested in reporting events in the Event Log using the ReportEvent API. This only appends a substring to the main message.
How do I write the MAIN message using C functions
Who is Participating?

Improve company productivity with a Business Account.Sign Up

xyuConnect With a Mentor Commented:
Get and unpack the file:

The "main" messages are defined in directory messages... it is messages.mc  se workspace there for example of the compilation MC to BIN :) good luck

or go to http://www.geocities.com/SiliconValley/1741
and download natlib library so You can use nwevlog.h/nwevlog.cpp (TWin32EventLog) to simplify event writing :)

Good Luck

What do you mean by MAIN message ?

ReportEvent(m_hEventSource, wType,       0,dwEventID,NULL, iNumberOfStrings,0,                  
                      pArrayOfStrings, NULL)

writes a perfect eventlog entry for me !

Write Binary Data with:
ReportEvent(m_hEventSource, wType, 0,dwEventID,NULL, 0,iNumOfBytes,
                             NULL, (LPVOID) pBuffer)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.