This example shows how to define the data passed with a Visual Studio Analyzer event as well as the process of calling FireEvent to generate the event. Refer to ISystemDebugEventFire Example (Visual Basic) to see this code in context.
' Generate an event.
Private Sub Sample_FireEvent(ByVal sEventGUID As String)
Dim Keys(1 To 3) As Variant, Values(1 To 3) As Variant
Dim lCount As Long
Dim lFlags As Long
' The event creator object must be active
' (as indicated by IsActive method).
' sEventGUID is the GUID of the event to generate
' and should be the GUID of a registered event.
' The FireEvent method takes an array of parameter names
' and their values.
' These parameters contain descriptive information about the event.
' The parameter names are strings.
' The parameter values can be strings or numerical.
' See VSAStandardParameter for a complete list of the system-defined
' event parameter names and descriptions.
' Create arrays of keys and values for passing the event parameters.
' Fixed-count arrays of variants are used here, but you can also use
' dynamic arrays and arrays of strings.
Keys(1) = PARAM_CausalityID ' A system-defined parameter
Values(1) = "SomeIDString"
Keys(2) = "MyCustomParam1" ' A custom parameter (text)
Values(2) = "SomeString"
Keys(3) = "MyCustomParam2" ' A custom parameter (number)
Values(3) = 7
' lCount is the total count of event parameters in the array
lCount = 3
' lFlags can contain zero or more Visual Studio Analyzer constants,
' which you can combine with a logical OR. See VSAEventFlags for a
' complete list of the constants you can use.
lFlags = cVSAEventStandard
Generate the event
mIEC.FireEvent sEventGUID, Keys, Values, lCount, lFlags
End Sub