VirtualBox

source: vbox/trunk/src/VBox/Main/testcase/VBoxVBTest/TestForm.frm

最後變更 在這個檔案是 33540,由 vboxsync 提交於 14 年 前

*: spelling fixes, thanks Timeless!

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Date Revision Author Id
檔案大小: 4.0 KB
 
1VERSION 5.00
2Begin VB.Form TestForm
3 Caption = "VirtualBox Test"
4 ClientHeight = 4692
5 ClientLeft = 60
6 ClientTop = 348
7 ClientWidth = 6972
8 LinkTopic = "TestForm"
9 ScaleHeight = 4692
10 ScaleWidth = 6972
11 StartUpPosition = 3 'Windows Default
12 Begin VB.ListBox machineList
13 Height = 2352
14 ItemData = "TestForm.frx":0000
15 Left = 240
16 List = "TestForm.frx":0007
17 TabIndex = 4
18 Top = 2040
19 Width = 6492
20 End
21 Begin VB.CommandButton getMachieListCmd
22 Caption = "Get Machine List"
23 Height = 372
24 Left = 2640
25 TabIndex = 0
26 Top = 720
27 Width = 1692
28 End
29 Begin VB.Label Label3
30 AutoSize = -1 'True
31 Caption = "Registered Machines:"
32 Height = 192
33 Left = 240
34 TabIndex = 5
35 Top = 1680
36 Width = 1572
37 End
38 Begin VB.Label versionLabel
39 AutoSize = -1 'True
40 Caption = "<none>"
41 Height = 192
42 Left = 1680
43 TabIndex = 3
44 Top = 1320
45 Width = 528
46 End
47 Begin VB.Label Label2
48 AutoSize = -1 'True
49 Caption = "VirtualBox Version:"
50 Height = 252
51 Left = 240
52 TabIndex = 2
53 Top = 1320
54 Width = 1344
55 End
56 Begin VB.Label Label1
57 Alignment = 2 'Center
58 Caption = $"TestForm.frx":0013
59 Height = 372
60 Left = 240
61 TabIndex = 1
62 Top = 120
63 Width = 6492
64 WordWrap = -1 'True
65 End
66End
67Attribute VB_Name = "TestForm"
68Attribute VB_GlobalNameSpace = False
69Attribute VB_Creatable = False
70Attribute VB_PredeclaredId = True
71Attribute VB_Exposed = False
72
73Private Declare Function SetEnvironmentVariable Lib "kernel32" _
74 Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long
75Private Declare Function GetEnvironmentVariable Lib "kernel32" _
76 Alias "GetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String, ByVal nSize As Long) As Long
77
78Private Sub Form_Load()
79
80 ' Set where to take VirtualBox configuration from
81
82 'SetEnvironmentVariable "VBOX_USER_HOME", "E:\VirtualBoxHome\win"
83
84 ' Setup debug logging (available only in debug builds)
85
86 'PATH_OUT_BASE = "D:/Coding/innotek/vbox/out"
87
88 'SetEnvironmentVariable "VBOX_LOG", "main.e.l.f + gui.e.l.f"
89 'SetEnvironmentVariable "VBOX_LOG_FLAGS", "time tid thread"
90 'SetEnvironmentVariable "VBOX_LOG_DEST", "dir:" + PATH_OUT_BASE + "/logs"
91
92End Sub
93
94Private Sub getMachieListCmd_Click()
95
96 ' Clear the old list contents
97
98 machineList.Clear
99 machineList.Refresh
100
101 versionLabel.Caption = "<none>"
102
103 ' Disable the button and the list for the duration of the call
104
105 getMachieListCmd.Enabled = False
106 machineList.Enabled = False
107
108 ' Obtain the global VirtualBox object (this will start
109 ' the VirtualBox server if it is not already started)
110
111 Dim vbox As VirtualBox.VirtualBox
112 Set vbox = New VirtualBox.VirtualBox
113
114 ' Get the VirtualBox server version
115
116 versionLabel.Caption = vbox.Version
117
118 ' Obtain a list of registered machines
119
120 Dim machines() As VirtualBox.IMachine
121 machines = vbox.Machines2
122
123 If UBound(machines) < 0 Then
124 machineList.AddItem ("<none>")
125 Else
126 For i = 0 To UBound(machines)
127 Item = machines(i).Name + " (" + machines(i).OSTypeId() + ")"
128 machineList.AddItem (Item)
129 Next i
130 End If
131
132 ' Reenable the button and the list
133
134 getMachieListCmd.Enabled = True
135 machineList.Enabled = True
136
137End Sub
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette