Registering New Events with Visual Studio Analyzer

See Also   

You can use any of the Visual Studio Analyzer system-defined events with your component, but you must register each event that you plan to generate. The Visual Studio Analyzer system-defined events provide information about components starting or stopping, function calls and returns, database queries, and transactions. See System-Defined Visual Studio Analyzer Events for a complete list of events.

If the system-defined events do not suit your purposes, you can register custom events. Custom events are registered the same way as system-defined events. You must register each custom event you plan to generate.

Add the code for registering events to your component installation or startup code — after the code for registering your component with Visual Studio Analyzer and after the code for registering any event categories.

Registering an Event

You must take the following steps with code in your component in order to register the events you want to generate.

  1. Register your component with Visual Studio Analyzer.

    If you want your component to generate Visual Studio Analyzer events, you must add code that will register the component with Visual Studio Analyzer. See Registering New Components with Visual Studio Analyzer for information on how to do this.

  2. Register any event categories you plan to use.

    You can use event categories to group related events. See Registering New Event Categories with Visual Studio Analyzer for information on how to do this.

  3. Call the RegisterStockEvent or RegisterCustomEvent methods of the event source installer object for each event you plan to generate.

    Use RegisterStockEvent for each system-defined event you plan to generate, and RegisterCustomEvent for each custom event. Both of these methods register the name and ID of the event.

    The interface exposed by the event source installer object is not a dual interface; therefore, the version of the interface you use depends on the language in which your application is written.

    Language Event Installer Interface
    Visual Basic, Visual J++ IsystemDebugEventInstallAuto
    Visual C++ ISystemDebugEventInstall

    If your component is not COM-enabled, use the Visual Studio Analyzer standard RPC interface, VsaRpcl.

  4. Destroy the event source installer object.