Using the EventLog Category (Task Category) in Windows 7 / Windows Server 2008 R2 RRS feed

  • Question

  • I have successfully used the category part of an event log message with Windows XP / 2003.

    I made a simple Messages.mc, like this:

    ; Id 0
    ; Id 1
    ; Id 2

    This file was compiled using the example found on MSDN:

    ; //  mc -s Messages.mc
    ; //  rc Messages.rc
    ; // link /DLL /SUBSYSTEM:WINDOWS /NOENTRY /MACHINE:x86 Messages.Res

    The resulting Messages.dll was added to the event log entry in registry, and using the corresponding id's I would get the textual part of the category when writing event log entries from my .NET application.


    Is this way of compiling a category DLL still valid for use with Windows 7 / Windows Server 2008 R2 ??


    I have seen some examples where a manifest xml file is used as a source instead of a *.mc file, but haven't found any examples that gives me only the category part. I am new to this manifest way of configuring event logging, so if someone could provide a simple example of how to accomplish this it would be great. :-)


    Best of regards...

    • Moved by eryang Friday, December 10, 2010 6:09 AM (From:.NET Base Class Library)
    Wednesday, December 8, 2010 11:22 PM

All replies

  • Hi,

    I move this thread to Windows Events  forum for better support.

    Please feel free to let us know if you have any concern.

    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 10, 2010 6:08 AM
  • Hi,

    In 2007 you need to also specify a message file not only a category file. I had the same problem.

    Basically I've created one file for both categories and messages and registered it in both places. If you use .Net then set the MessageResourceFile, CategoryResourceFile and CategoryCount properties of a new EventSourceCreationData, then use this object when calling the EventLog.CreateSource.

    If the MessageResourceFile is not specified, a default one is used and Windows 7 seems to ignore the category file.



    Wednesday, May 18, 2011 7:14 AM