Developing VM-Typer (Part 3)

So now we have a basic application up and running with the right COM security model, the right threading apartment model and a connection to the Virtual Server instance (from past posts: https://blogs.msdn.com/virtual_pc_guy/archive/2005/05/26/422447.aspx). Finally what we need to do for VM-Typer is to actually type the text:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim myVM As VMVirtualMachine

        'Create a connection to the virtual machine specified in the ComboBox
myVM = virtualServer.FindVirtualMachine(ComboBox1.Text)

        'Type the contents of TextBox2 to the virtual machine
myVM.Keyboard.TypeAsciiText(TextBox2.Text)

    End Sub

    'Simple logic class to respond to radio button changes
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged

        If RadioButton2.Checked Then
TextBox1.Enabled = True
Else
TextBox1.Enabled = False
End If

    End Sub

And with that we now have everything set up and the application is complete. What we have is a very handy little application that can 'cut and paste' text into any given virtual machine. Personally this has become a favorite tool of mine and is installed on all of my work computers :-)

Cheers,
Ben