RegisterEventCategory Example (Visual C++)

   Applies To

This example shows what a call to RegisterEventCategory looks like. Refer to ISystemDebugEventInstall Example (Visual C++) to see the constant declarations and object creation code, as well as to see this code in a form you can run with minor modifications.

// Register a custom event category for the component.

// SAMPLE_SOURCE_GUID is the component for the category being registered.

// SAMPLE_CATEGORY_GUID is a unique GUID for the category (defined
// above); substitute the GUID for your component.

// If you want the category to appear in a hierarchy, specify a parent
// (DEBUG_EVENT_CATEGORY_ALL will be the parent of this category).

// If you do not specify a parent, your category will appear at the top
// level in the Filter Editor.
// Assign a name (Sample Event Category) and description
// (Category for all sample events) using Unicode characters.
void SampleRegisterCategory()
{
   pESI->RegisterEventCategory( SAMPLE_SOURCE_GUID, SAMPLE_CATEGORY_GUID,
      DEBUG_EVENT_CATEGORY_ALL, L"Sample Event Category",
      L"Category for all sample events", NULL, 0 );
}