EventLog handling

Posted on 2000-05-08
Last Modified: 2013-12-03
Hey pals,

I'm trying to send some pretty simple messages to Event log file on NT 4.
Well, I tried just to use insertion strings parameter at ReportEvent
function but my boss got scared with "Description could not be found" messages. So I have no choice but to
create MC file.

Something went wrong with that - I performed all steps as written at MSDN
but no effect.
I understand there could be billions of reasons why it doesn't work, therefore I wonder if anyone could send me a simple example that would include : mc file, cpp file with ReportEvent function
call and step-by-step instructions how could I make dll from mc file.

Thanks in advance
Question by:schild
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
LVL 15

Accepted Solution

NickRepin earned 200 total points
ID: 2790409

You have to create your own key under

In my case (see event.reg below), the source name is EventSourceName("Event test").

EventMessageFile must point to your dll or exe file that contains the messages.

You may double-click on event.reg to write values into the registry, but you should modify the path to your program before.


MessageId=1000 SymbolicName=EVENT_HELLO
Hello from the %1.

MessageId= SymbolicName=EVENT_BYE
Bye from the %1.


#include <windows.h>
#include <iostream.h>
#include "event.h"

HANDLE  hEventLog=0;
LPCTSTR EventSourceName=TEXT("Event test");

void main(void)
   if(!hEventLog) {
      cout<<"Unable to register"<<endl;




rem ------------------------------------
rem ------------------------------------
@echo off
rc event.rc
cl event.cpp event.res advapi32.lib



[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Event test]

LVL 15

Expert Comment

ID: 2790417
There must be only the one dot after a message in the .MC file.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

710 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