RegisterEventCategory Example (Visual Basic)

   Applies To

This example shows how to register an event category. Refer to ISystemDebugEventInstall Example (Visual Basic) to see this code in context.

' Register a custom event category.
Private Sub Sample_RegisterEventCategory(ByVal sSourceGUID As String)
   Dim sEventCategoryGUID As String
   Dim sParentGUID As String
   Dim sEventCategoryName As String
   Dim sEventCategoryDescr As String
   Dim sIconFile As String, lIcon As Long

   ' sSourceGUID is the component for which to register 
   ' this custom event category.
   ' Create a unique GUID for the custom event category; 
   ' substitute your own in the following line.
   sEventCategoryGUID = "{B3303263-5C87-11d1-A2AD-00AA003B23FF}"

   ' If you want to specify a position in a hierarchy, 
   ' specify a parent, such as All Events; leaving this empty 
   ' will place your custom category at the top level in the 
   ' Filter Editor.
   sParentGUID = ""

   ' Specify a name and description for the event category
   sEventCategoryName = "MyCustomEventCategory1"
   sEventCategoryDescr = "MyCustomEventCategory1 Description"

   ' Pass the next two parameters empty
   sIconFile = "": lIcon = 0

   ' Run the method
   mESI.RegisterEventCategory sSourceGUID, _
      sEventCategoryGUID, _
      sParentGUID, _
      sEventCategoryName, _
      sEventCategoryDescr, _
      sIconFile, _
      lIcon
End Sub