Adding Categories for EventsLast reviewed: September 25, 1995Article ID: Q115947 |
The information in this article applies to:
SUMMARYThe ReportEvent() API accepts a category ID as one of the arguments. The "Microsoft Win32 Programmer's Reference" states that you can add your own categories for events. This article shows you how to add categories that will be recognized by the Event Viewer; however, the article assumes that you already know how to create a message file and add an event source to the registry. For information about basic event logging, please see the logging sample in the Q_A\SAMPLES\logging directory on the "Win32 SDK" CD. NOTE: The logging example that comes with Visual C++ 2.0 does not bind the MESSAGES.RC to the MESSAGES.DLL unlike the logging example that accompanies the Win32 SDK or NSDN Level 2. Binding MESSAGES.RC to the MESSAGES.DLL can be accomplished by adding MESSAGES.RC to MESSAGES.MAK. NOTE: If you notice that there are some entries that have a .DLL name and a driver name while you are attempting to read messages from the event log, this means that the event message source has more than one message file. This means you need to parse the string and load each message file.
MORE INFORMATIONJust like events, category IDs are simply IDs in message file resources. However, in order to use categories, the following two requirements must be met:
The category entries in the registry are made by adding values to your event key. Normally, your event log application key already contains EventMessageFile and TypesSupported entries. You should add the following two entries:
The CategoryCount entry is a REG_DWORD type. You should set this entry to the number of categories in the message file specified in CategoryMessageFile.
REFERENCES"Microsoft Win32 Programmer's Reference," Microsoft Corporation.
|
Additional reference words: 3.10 3.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |