d9c184489b6356c301695606f409c1a6a6f58793vboxsyncVERSION 5.00
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncBegin VB.Form TestForm
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Caption = "VirtualBox Test"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ClientHeight = 4692
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ClientLeft = 60
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ClientTop = 348
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ClientWidth = 6972
d9c184489b6356c301695606f409c1a6a6f58793vboxsync LinkTopic = "TestForm"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ScaleHeight = 4692
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ScaleWidth = 6972
d9c184489b6356c301695606f409c1a6a6f58793vboxsync StartUpPosition = 3 'Windows Default
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Begin VB.ListBox machineList
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Height = 2352
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ItemData = "TestForm.frx":0000
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Left = 240
d9c184489b6356c301695606f409c1a6a6f58793vboxsync List = "TestForm.frx":0007
d9c184489b6356c301695606f409c1a6a6f58793vboxsync TabIndex = 4
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Top = 2040
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Width = 6492
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Begin VB.CommandButton getMachieListCmd
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Caption = "Get Machine List"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Height = 372
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Left = 2640
d9c184489b6356c301695606f409c1a6a6f58793vboxsync TabIndex = 0
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Top = 720
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Width = 1692
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Begin VB.Label Label3
d9c184489b6356c301695606f409c1a6a6f58793vboxsync AutoSize = -1 'True
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Caption = "Registered Machines:"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Height = 192
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Left = 240
d9c184489b6356c301695606f409c1a6a6f58793vboxsync TabIndex = 5
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Top = 1680
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Width = 1572
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Begin VB.Label versionLabel
d9c184489b6356c301695606f409c1a6a6f58793vboxsync AutoSize = -1 'True
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Caption = "<none>"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Height = 192
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Left = 1680
d9c184489b6356c301695606f409c1a6a6f58793vboxsync TabIndex = 3
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Top = 1320
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Width = 528
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Begin VB.Label Label2
d9c184489b6356c301695606f409c1a6a6f58793vboxsync AutoSize = -1 'True
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Caption = "VirtualBox Version:"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Height = 252
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Left = 240
d9c184489b6356c301695606f409c1a6a6f58793vboxsync TabIndex = 2
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Top = 1320
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Width = 1344
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Begin VB.Label Label1
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Alignment = 2 'Center
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Caption = $"TestForm.frx":0013
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Height = 372
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Left = 240
d9c184489b6356c301695606f409c1a6a6f58793vboxsync TabIndex = 1
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Top = 120
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Width = 6492
d9c184489b6356c301695606f409c1a6a6f58793vboxsync WordWrap = -1 'True
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncEnd
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncAttribute VB_Name = "TestForm"
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncAttribute VB_GlobalNameSpace = False
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncAttribute VB_Creatable = False
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncAttribute VB_PredeclaredId = True
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncAttribute VB_Exposed = False
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncPrivate Declare Function SetEnvironmentVariable Lib "kernel32" _
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncPrivate Declare Function GetEnvironmentVariable Lib "kernel32" _
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String, ByVal nSize As Long) As Long
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncPrivate Sub Form_Load()
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Set where to take VirtualBox configuration from
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync 'SetEnvironmentVariable "VBOX_USER_HOME", "E:\VirtualBoxHome\win"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Setup debug logging (available only in debug builds)
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync 'PATH_OUT_BASE = "D:/Coding/innotek/vbox/out"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync 'SetEnvironmentVariable "VBOX_LOG", "main.e.l.f + gui.e.l.f"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync 'SetEnvironmentVariable "VBOX_LOG_FLAGS", "time tid thread"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync 'SetEnvironmentVariable "VBOX_LOG_DEST", "dir:" + PATH_OUT_BASE + "/logs"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncEnd Sub
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncPrivate Sub getMachieListCmd_Click()
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync ' Clear the old list contents
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machineList.Clear
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machineList.Refresh
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync versionLabel.Caption = "<none>"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Disable the button and the list for the duration of the call
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync getMachieListCmd.Enabled = False
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machineList.Enabled = False
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Obtain the global VirtualBox object (this will start
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' the VirtualBox server if it is not already started)
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Dim vbox As VirtualBox.VirtualBox
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Set vbox = New VirtualBox.VirtualBox
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Get the VirtualBox server version
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync versionLabel.Caption = vbox.Version
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Obtain a list of registered machines
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Dim machines() As VirtualBox.IMachine
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machines = vbox.Machines2
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync If UBound(machines) < 0 Then
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machineList.AddItem ("<none>")
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Else
d9c184489b6356c301695606f409c1a6a6f58793vboxsync For i = 0 To UBound(machines)
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Item = machines(i).Name + " (" + machines(i).OSTypeId() + ")"
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machineList.AddItem (Item)
d9c184489b6356c301695606f409c1a6a6f58793vboxsync Next i
d9c184489b6356c301695606f409c1a6a6f58793vboxsync End If
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync ' Reenable the button and the list
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsync getMachieListCmd.Enabled = True
d9c184489b6356c301695606f409c1a6a6f58793vboxsync machineList.Enabled = True
d9c184489b6356c301695606f409c1a6a6f58793vboxsync
d9c184489b6356c301695606f409c1a6a6f58793vboxsyncEnd Sub