So the first week of App Building has gone well.  I'll write more about my app as soon as it is finished, but I figured I would share a code snippet which you may find helpful.

The Virtual Server 2005 COM API allows you to do a great many things, even get a thumbnail image of the virtual machine's screen.  Unfortunately however that property is returned as an array of integers which are persisted as Object[].  In other words the functionality is there but you need to convert it to something useful yourself.

The following routine does this convertion for you in VB.NET:

''' <summary>
''' Returns the thumbnail for the underlying
''' Virtual Machine.
''' </summary>
''' <remarks>
''' If the Virtual Machine is off then the thumbnail will
''' be solid gray. 
''' Also, this code snippet will only work with
''' Visual Studio 2005 codenamed Whidbey since it takes
''' advantage a new VB.NET feature, unsigned integers.

''' </remarks>
Public ReadOnly Property Thumbnail() As Bitmap
   Get
      
' Get the int array from VServer
      Dim pixelArrayObj As Object
()
      pixelArrayObj = CType( _
               
m_comVirtualMachine.Display.Thumbnail, _
               Object
())

      ' Convert it to a bitmap
      
Dim bmp As New
Bitmap(64, 48)

      ' Pixel index

      Dim i As Integer = 0

      ' The thumbnail is always 64x48
      For y As Integer = 0 To 47
         For x As Integer = 0 To
63

            Dim uiPixel As
UInteger = CUInt(pixelArrayObj(i))
            Dim red, green, blue As Integer
            
            
red = CInt((uiPixel >> 8) Mod
256)
            green = CInt((uiPixel >> 16) Mod
256)
            blue = CInt((uiPixel >> 24) Mod
256)

            bmp.SetPixel(x, y, _
                        
Color.FromArgb(red, green, blue))
            i += 1
         Next
      Next

      R
eturn
bmp
   End
Get

End
Property

Disclaimer: The code snippet is offered 'as is' and offers no warranties, expressed or implied.  If that 40-line function is somehow responsible for your computer becoming self-aware and taking over the human race, sorry, but don’t blame me or Microsoft.