Information and Guidelines for Visual Basic Programmers

See Also   

To access the Visual Studio Analyzer programming interfaces from within Visual Basic, you need to add two type library references to your Visual Basic project. Once you add the type library references, you can access the methods within the programming interfaces using the Object Browser.

To add the Visual Studio Analyzer type library references

  1. Click the Project menu, and then click References.

  2. In the Available references box, select the check box for the following two type libraries:
  3. Click OK.

These libraries give you access to the event source installer and in-process event creator classes. You can use the Object Browser to access the methods for each class.

Constants for Visual Studio Analyzer Predefined Events

Visual Studio Analyzer ships with a number of predefined events. These events are identified by global unique identifiers (GUIDs) and must be referred to by their GUID each time you use them in code. However, you can make using these predefined events a little easier for yourself by creating constants for these events and saving them in a global file.

The following listing contains constant definitions for the Visual Studio Analyzer predefined events. You can copy and paste this code into a global module in your Visual Basic projects.

Option Explicit

'These are the definitions of the VSA Event field names.
'They are used in the Key array when passing data.  The
'difference between default and non default parameters is
'that the IEC and LEC provide information in these parameters
'if the cVSAEventDefaultSource and the cVSAEventDefaultTarget
'flags are specified in the FireEvent call

' Default Parameters
Public Const PARAM_SourceMachine = "SourceMachine"
Public Const PARAM_SourceProcessID = "SourceProcessId"
Public Const PARAM_SourceThread = "SourceThread"
Public Const PARAM_SourceComponent = "SourceComponent"
Public Const PARAM_SourceSession = "SourceSession"
Public Const PARAM_TargetMachine = "TargetMachine"
Public Const PARAM_TargetProcessID = "TargetProcessId"
Public Const PARAM_TargetThread = "TargetThread"
Public Const PARAM_TargetComponent = "TargetComponent"
Public Const PARAM_TargetSession = "TargetSession"
Public Const PARAM_SecurityIdentity = "SecurityIdentity"
Public Const PARAM_CausalityID = "CausalityID"
Public Const PARAM_SourceProcessName = "SourceProcessName"
Public Const PARAM_TargetProcessName = "TargetProcessName"

' Non Default Parameters
Public Const PARAM_SourceHandle = "SourceHandle"
Public Const PARAM_TargetHandle = "TargetHandle"
Public Const PARAM_Arguments = "Arguments"
Public Const PARAM_ReturnValue = "ReturnValue"
Public Const PARAM_Exception = "Exception"
Public Const PARAM_CorrelationID = "CorrelationID"

'The null guid
Public Const GUID_NULL = "{00000000-0000-0000-0000-000000000000}"

'The 'user' event source, which is autoregistered for all stock events
Public Const DEBUG_EVENT_SOURCE_USER = _
"{6C736D00-BCBF-11D0-8A23-00AA00B58E10}"

'These are the definitions of the stock events that are available in VSA
'These are defined in detail in the MSDN documentation
Public Const DEBUG_EVENT_CALL = "{6C736D61-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_RETURN = _
"{6C736D62-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_COMPONENT_START = _
"{6C736D63-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_COMPONENT_STOP = _
"{6C736D64-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_CALL_DATA = _
"{6C736D65-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_ENTER = _
"{6C736D66-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_ENTER_DATA = _
"{6C736D67-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_LEAVE_NORMAL = _
"{6C736D68-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_LEAVE_EXCEPTION = _
"{6C736D69-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_LEAVE_DATA = _
"{6C736D6A-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_RETURN_DATA = _
"{6C736D6B-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_RETURN_NORMAL = _
"{6C736D6C-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_RETURN_EXCEPTION = _
"{6C736D6D-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_QUERY_SEND = _
"{6C736D6E-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_QUERY_ENTER = _
"{6C736D6F-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_QUERY_LEAVE = _
"{6C736D70-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_QUERY_RESULT = _
"{6C736D71-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_TRANSACTION_START = _
"{6C736D72-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_TRANSACTION_COMMIT = _
"{6C736D73-BCBF-11D0-8A23-00AA00B58E10}"
Public Const DEBUG_EVENT_TRANSACTION_ROLLBACK = _
"{6C736D74-BCBF-11D0-8A23-00AA00B58E10}"