Platform SDK: Debugging and Error Handling |
Each event sources should register message files that contain description strings for each event identifier, event category, and parameter. Register these files in the EventMessageFile, CategoryMessageFile, and ParameterMessageFile registry values for the event source. You can create one message file that contains descriptions for the event identifiers, categories, and parameters, or create three separate message files. Several applications can share the same message file.
You should typically create message files as dynamic-link libraries (DLL). Use the following procedure to create these DLLs.
To create a message file
cl options -fo filename.obj filename.c.
mc filename.mc.
rc -r -fo filename.res filename.rc.
link -dll -out:filename.dll filename.obj filename.res.
To make it easier for the application to use your message file, create a header file that lists each event. For example, suppose you have defined the following message in your .MC file:
MessageId=0x4 Severity=Error Facility=System SymbolicName=MSG_CMD_DELETE Language=English File %1 contains %2, which is in error.
Your header file should contain the following code:
// // MessageId: MSG_CMD_DELETE // MessageText: // File %1 contains %2, which is in error. // #define MSG_CMD_DELETE ((DWORD)0xC0000004L)
Now the event-viewing application can use the following procedure to gain access to the description strings in the message file.
To obtain description strings