Solved

Writing to NT Event Log

Posted on 1998-09-09
3
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

734 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