RegisterDynamicSource Example (Visual C++)

   Applies To

This example shows what a call to RegisterDynamicSource 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 the dynamic component.
// SAMPLE_DYNAMIC_SOURCE_GUID is defined in preceding code; substitute 
// the GUID for your dynamic component. Assign a name (Sample Dynamic 
// Source) and a description (A sample dynamic component) using Unicode 
// characters.

// If the dynamic component is a COM object that you want VSA to start
// automatically, provide its CLSID (CLSID_SAMPLE_DYNAMIC_SOURCE).

// Also specify whether the COM object should be started in process (true
// or false). Note that dynamic components should usually be created
// out-of-process so that if they crash, Visual Studio Analyzer will not
// be affected.

void SampleRegisterDynamicSource()

{
   pESI->RegisterDynamicSource( L"Sample Dynamic Source", 
      SAMPLE_DYNAMIC_SOURCE_GUID,

      L"A sample dynamic component", CLSID_SAMPLE_DYNAMIC_SOURCE, false );
}