Receiving Microsoft Virtual Server events from a managed program

Ben Armstrong continues his Virtual Server development series, this time explaining how to handle events from a managed application:

  • Setup the managed application appropriately to talk to the Virtual Server COM interfaces
  • Declare your Virtual Server COM object ‘WithEvents’ as follows:
  • Private WithEvents virtualServer As VMVirtualServer = Nothing

    instead of:

    Private virtualServer As VMVirtualServer = Nothing

  • Create a subroutine to catch the event:
  • Public Sub virtualServer_EventLogged(ByVal logMessageID As Integer) Handles virtualServer.OnEventLogged

    ‘Do something with the event

    End Sub

You should read the original post for helpful comments and further explainations from Ben.