RegisterDynamicSource Example (Visual Basic)

   

This example shows how to register a dynamic component. Refer to ISystemDebugEventInstall Example (Visual Basic) to see this code in context.

' Register a dynamic component with Visual Studio Analyzer.
Private Sub Sample_RegisterDynamicSource()
   Dim sDynamicSourceGUID As String
   Dim sDynamicSourceName As String
   Dim sDynamicSourceDescr As String
   Dim sCLSID As String
   Dim lInProc As Long
   ' You need a unique GUID to assign to the component;
   ' substitute your own in the following line.
   sDynamicSourceGUID = "{B3303260-5C87-11d1-A2AD-00AA003B23FF}"
   ' Assign a name and description to the component.
   sDynamicSourceName = "MyDynamicEventSource1"
   sDynamicSourceDescr = "MyDynamicEventSource1 Description"
   ' If the dynamic component is a COM object that you want VSA to start
   ' automatically, you need to provide its CLSID. Substitute the correct
   ' CLSID in the following line.
   sCLSID = "{B3303261-5C87-11d1-A2AD-00AA003B23FF}"
   ' Specify whether your COM object should be started in process;
   ' use nonzero for true, zero for false.
   lInProc = 1
   ' Run the method.
   mESI.RegisterDynamicSource _
      sDynamicSourceGUID, _
      sDynamicSourceName, _
      sDynamicSourceDescr, _
      sCLSID, _
      lInProc
End Sub