RegisterCustomEvent Example (Visual C++)

   Applies To

This example shows what a call to RegisterCustomEvent 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 user-defined event for the component to generate. 

// SAMPLE_SOURCE_GUID is the component that will generate the event
// being registered.

// SAMPLE_EVENT_GUID is a unique GUID for the event (defined in preceding 
// code); substitute the GUID for your component.
// Assign a Name (Sample Event) and Description (Event generated by the
// component) using Unicode characters. 
void SampleRegisterCustomEvent()
{
   pESI->RegisterCustomEvent( SAMPLE_SOURCE_GUID, SAMPLE_EVENT_GUID,
      L"Sample Event", L"Event generated by the component ", 
      DEBUG_EVENT_TYPE_GENERIC, SAMPLE_CATEGORY_GUID, NULL, 0 );
}