|
|
Title |
Writing to the NT event log
|
Summary |
To avoid seeing the "Description for Event ID (####) not found" message when writing to the NT event log. |
Contributor |
John McTainsh
|
Published |
19-Sep-2000 |
Last updated |
19-Sep-2000 |
|
|
Download EventLogging files - 18 Kb
Description.
Writing to the Event log and avoiding the following message can be achieved
by using the following method.
The description for Event ID ( #### ) in Source ( ????????? ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. The following information is part of the event:
Write to the Log.
You should have a look at the MSDN article "The NT EventLog,
Part 1: Meet the API" for an understanding of how events are used.
In this example DamCool is the application name.
In the StdAfx.h include the following lines.
#define EVENT_APP_TITLE _T("DamCool")
#include "Revision.h"
Include the EventLogWriter.cpp in the build.
Where the event is to be written use printf type formatting.
...
WriteEvent( EVENTLOG_INFORMATION_TYPE,
_T("Starting!.. %s\r\nInteractive = %d"),
GetCommandLine(), IsInteractiveUser() );
...
Pointing to the formatting DLL.
When writing to the Event log you need a file listing the formatting.
For the event view to locate this file put the following into a
*.reg file and add double click on it to install. Don't forget to replace
DamCool and place PrintrakBneLog.dll into System32.
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\DamCool]
"EventMessageFile"="%SystemRoot%\\System32\\PrintrakBneLog.dll"
"CategoryMessageFile"="%SystemRoot%\\System32\\PrintrakBneLog.dll"
"TypesSupported"=dword:00000007
"CategoryCount"=dword:00000001
|