Reading a pixel on a VM Screen

Two weeks ago I provided a code sample that allowed you to capture a Hyper-V virtual machine screen to a bitmap.  As part of this script – the virtual machine screen is stored in a Windows bitmap object.  There are actually a number of interesting things you can do with this object.

On such thing is to get individual pixel data from the screen.  You can do this as follows:

This will produce results like this:

R             : 57
G             : 81
B             : 82
A             : 255
IsKnownColor  : False
IsEmpty       : False
IsNamedColor  : False
IsSystemColor : False
Name          : ff395152

You can then use this to test for what is happening inside the virtual machine in a non-intrusive manner.

Cheers,
Ben