-
July 23rd, 2001, 12:50 PM
#1
ReportEvent() grrrrr...
Hello,
I've been having problems getting ReportEvent() to work. The event log displays the text "The description for Event ID ( 6001 ) in Source ( MyApp ) cannot be found. [etc.]" before the text entered in ReportEvent(). I've tried using mc.exe to create a separate resource and linked it to the resource compiler adding the new resource and header (ResourceView>>ResourceIncludes...). I've also compiled the resource into a separate dll but this also doesnt work. What am i missing? Thanks in advance, Chris
-
July 23rd, 2001, 01:08 PM
#2
Re: ReportEvent() grrrrr...
Is the message source properly registered? Could you reproduce the registration
entries here?
-
July 23rd, 2001, 01:25 PM
#3
Re: ReportEvent() grrrrr...
Hi Alex,
Here is my code...
hApplicationLog = RegisterEventSource(NULL, "MyApp");
int result = ReportEvent( hApplicationLog,
EVENTLOG_ERROR_TYPE,
0, // category
MSG_CANTCREATELOGFILE, // event id
NULL, // user sid
1, // number of strings
0, // data size
(LPCTSTR*)&error, // array o'strings
NULL ); // data pointer
In conjuction with the .mc reading
FacilityNames=(MyApp=111)
MessageId=6001
Severity=Error
SymbolicName=MSG_CANTCREATELOGFILE
FacilityName=MyApp
Language=English
Could not create log file
.
I have also tried registering using OpenEventLog() and using the default setting "Facility=Application" in the *.mc file.
Nothing seems to help! Thanks, Chris
-
July 23rd, 2001, 02:19 PM
#4
Re: ReportEvent() grrrrr...
I meant you show the entries in the registry you made to
register your event source.
-
July 23rd, 2001, 02:34 PM
#5
Re: ReportEvent() grrrrr...
Sorry Alex, I misunderstood.
I didn't know the registry was involved.
The RegisterEventSource returns a valid handle, but there is no entry in the registry...
When i do...
hApplicationLog = RegisterEventSource(NULL, "UniqueString");
and then do
Registry Editor>>Edit>>Find..."UniqueString"
the registry comes back with nothing.
Thanks, Chris.
-
July 23rd, 2001, 02:53 PM
#6
Re: ReportEvent() grrrrr...
In order the Event Viewer to find your DLL that contains a message resource,
you should add some entries to the system registry. In the very simple case
the following entries will be enough:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\Application\your-name
EventMessageFile[REG_SZ] = path to your DLL
TypesSupported[REG_DWORD] = 7
See event logging documentation on MSDN for more information:
http://msdn.microsoft.com/library/en...ntlog_6jhv.asp
See also the following knowledge base article:
http://support.microsoft.com/support.../Q166/9/02.asp
-
July 23rd, 2001, 03:34 PM
#7
Re: ReportEvent() grrrrr...
Thanks for your time Alex,
I appreciate it.
Chris.
-
December 22nd, 2015, 05:23 PM
#8
Re: ReportEvent() grrrrr...
Originally Posted by chris haddon
Hello,
I've been having problems getting ReportEvent() to work. The event log displays the text "The description for Event ID ( 6001 ) in Source ( MyApp ) cannot be found. [etc.]" before the text entered in ReportEvent(). I've tried using mc.exe to create a separate resource and linked it to the resource compiler adding the new resource and header (ResourceView>>ResourceIncludes...). I've also compiled the resource into a separate dll but this also doesnt work. What am i missing? Thanks in advance, Chris
This an old link, but I've got a legacy app I'm working with that generates the same errors.
Basically I scrapped the NTService.LogEvent function and used the simple I found a simple code fix here:
http://www.jameswiseman.com/blog/201...-event-logger/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|