Welcome to MSDN Blogs Sign in | Join | Help

Receiving Virtual Server events from a managed program

Last week I talked about how to receive Virtual Server events from a VBScript - this week I am going to talk about doing this from a managed application.  To do this you need to:

  1. Setup the managed application appropriately to talk to the Virtual Server COM interfaces (details here: http://blogs.msdn.com/virtual_pc_guy/search.aspx?q=typer&p=1)

  2. Declare your Virtual Server COM object 'WithEvents' as follows:


    Private WithEvents virtualServer As VMVirtualServer = Nothing

    instead of:

    Private virtualServer As VMVirtualServer = Nothing

  3. Create a subroutine to catch the event:

    Public Sub virtualServer_EventLogged(ByVal logMessageID As Integer) Handles virtualServer.OnEventLogged

         'Do something with the event
         msgbox(CStr(logMessageID))

    End Sub

There - really quite simple.

Cheers,
Ben

Published Thursday, January 26, 2006 11:43 PM by Virtual PC Guy

Comments

Friday, January 27, 2006 10:38 AM by Ying Jin

# re: Receiving Virtual Server events from a managed program

Hi, Ben,
Very nice series on Event detection and handling on VS.

We are trying to detect when a legacy(and unstable) application crash the virtual machine. Is such event a vmVirtualMachineEvent_TripleFault or a
vmVirtualMachineEvent_HeartbeatStopped?

What are the difference between these two events in terms of impact on host OS?

Ying
Friday, January 27, 2006 12:48 PM by Virtual PC Guy

# re: Receiving Virtual Server events from a managed program

Hi Ying,

You should be looking at 'HeartbeatStopped' event - as that will fire whenever the virtual machine crashes. TripleFault is a specific kind of crash - and will still trigger a 'HeartbeatStopped' event.

Cheers,
Ben
New Comments to this post are disabled
 
Page view tracker