Solved

Writing to NT Event Log

Posted on 1998-09-09
3
211 Views
Last Modified: 2010-04-15
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
0
Comment
Question by:anandg090998
  • 2
3 Comments
 
LVL 1

Expert Comment

by:jkrautner
ID: 1252556
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 !


0
 
LVL 1

Expert Comment

by:jkrautner
ID: 1252557
Write Binary Data with:
ReportEvent(m_hEventSource, wType, 0,dwEventID,NULL, 0,iNumOfBytes,
                             NULL, (LPVOID) pBuffer)
0
 
LVL 3

Accepted Solution

by:
xyu earned 100 total points
ID: 1252558
Get and unpack the file:
http://www.geocities.com/SiliconValley/1741/miscprog/logging.zip

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

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now