-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrmUSBView.frm
More file actions
301 lines (286 loc) · 7.66 KB
/
frmUSBView.frm
File metadata and controls
301 lines (286 loc) · 7.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
'frmUSBView.frm
' Copyright (c) 2025 CM.Wang
' Freeware. Use at your own risk.
'#Region "Form"
#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
#define __MAIN_FILE__
#ifdef __FB_WIN32__
#cmdline "Form1.rc"
#endif
Const _MAIN_FILE_ = __FILE__
#endif
#include once "mff/Form.bi"
#include once "mff/TreeView.bi"
#include once "mff/TextBox.bi"
#include once "mff/Splitter.bi"
#include once "mff/Panel.bi"
#include once "mff/CommandButton.bi"
#include once "mff/StatusBar.bi"
#include once "mff/CheckBox.bi"
#include once "mff/ImageList.bi"
#include once "../MDINotepad/Text.bi"
#include once "USBView.bi"
Using My.Sys.Forms
Type frmUSUViewType Extends Form
Declare Sub CommandButton_Click(ByRef Sender As Control)
Declare Sub CheckBox3_Click(ByRef Sender As CheckBox)
Declare Sub TreeView1_SelChanged(ByRef Sender As TreeView, ByRef Item As TreeNode)
Declare Sub Form_Show(ByRef Sender As Form)
Declare Sub Form_Close(ByRef Sender As Form, ByRef Action As Integer)
Declare Sub Form_Create(ByRef Sender As Control)
Declare Constructor
Dim As TreeView TreeView1
Dim As TextBox TextBox1
Dim As Splitter Splitter1
Dim As Panel Panel1, Panel2
Dim As CommandButton cmdRefresh, cmdEnabled, cmdDisabled, cmdRemoved, cmdEject
Dim As StatusBar StatusBar1
Dim As StatusPanel StatusPanel1
Dim As CheckBox CheckBox1, CheckBox2, CheckBox3
Dim As ImageList ImageList1
End Type
Constructor frmUSUViewType
#if _MAIN_FILE_ = __FILE__
With App
.CurLanguagePath = ExePath & "/Languages/"
.CurLanguage = My.Sys.Language
End With
#endif
' frmUSUView
With This
.Name = "frmUSUView"
.Text = "USB View"
.Designer = @This
.Caption = "USB View"
.StartPosition = FormStartPosition.CenterScreen
#ifdef __USE_GTK__
This.Icon.LoadFromFile(ExePath & "/USBView.ico")
#else
This.Icon.LoadFromResourceID(1)
#endif
.OnShow = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Form), @Form_Show)
.OnClose = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Form, ByRef Action As Integer), @Form_Close)
.OnCreate = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @Form_Create)
.SetBounds 0, 0, 750, 500
End With
' TreeView1
With TreeView1
.Name = "TreeView1"
.Text = "TreeView1"
.TabIndex = 0
.Align = DockStyle.alLeft
.ExtraMargins.Left = 10
.ExtraMargins.Top = 10
.ExtraMargins.Bottom = 10
.Images = @ImageList1
.SetBounds 10, 10, 300, 419
.Designer = @This
.OnSelChanged = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As TreeView, ByRef Item As TreeNode), @TreeView1_SelChanged)
.Parent = @This
End With
' Splitter1
With Splitter1
.Name = "Splitter1"
.Text = "Splitter1"
.SetBounds 210, 0, 10, 261
.Designer = @This
.Parent = @This
End With
' Panel1
With Panel1
.Name = "Panel1"
.Text = "Panel1"
.TabIndex = 2
.Align = DockStyle.alClient
.ExtraMargins.Right = 10
.ExtraMargins.Top = 10
.ExtraMargins.Bottom = 10
.SetBounds 204, 0, 250, 261
.Designer = @This
.Parent = @This
End With
' Panel2
With Panel2
.Name = "Panel2"
.Text = "Panel2"
.TabIndex = 3
.Align = DockStyle.alBottom
.SetBounds 0, 389, 404, 30
.Designer = @This
.Parent = @Panel1
End With
' TextBox1
With TextBox1
.Name = "TextBox1"
.Text = ""
.TabIndex = 1
.Multiline = True
.ID = 1004
.ScrollBars = ScrollBarsType.Both
.Align = DockStyle.alClient
.ControlIndex = 1
.Font.Name = "Consolas"
.SetBounds 0, 0, 404, 389
.Designer = @This
.Parent = @Panel1
End With
' cmdRefresh
With cmdRefresh
.Name = "cmdRefresh"
.Text = "Refresh"
.TabIndex = 4
.Caption = "Refresh"
.SetBounds 0, 9, 70, 20
.Designer = @This
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton_Click)
.Parent = @Panel2
End With
' cmdEnabled
With cmdEnabled
.Name = "cmdEnabled"
.Text = "Enabled"
.TabIndex = 5
.Caption = "Enabled"
.Visible = False
.SetBounds 80, 9, 70, 20
.Designer = @This
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton_Click)
.Parent = @Panel2
End With
' cmdDisabled
With cmdDisabled
.Name = "cmdDisabled"
.Text = "Disabled"
.TabIndex = 6
.Caption = "Disabled"
.Visible = False
.SetBounds 160, 9, 70, 20
.Designer = @This
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton_Click)
.Parent = @Panel2
End With
' cmdRemoved
With cmdRemoved
.Name = "cmdRemoved"
.Text = "Removed"
.TabIndex = 7
.Caption = "Removed"
.Visible = False
.SetBounds 240, 9, 70, 20
.Designer = @This
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton_Click)
.Parent = @Panel2
End With
' cmdEject
With cmdEject
.Name = "cmdEject"
.Text = "Eject"
.TabIndex = 8
.Caption = "Eject"
.Visible = False
.SetBounds 320, 9, 70, 20
.Designer = @This
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton_Click)
.Parent = @Panel2
End With
' StatusBar1
With StatusBar1
.Name = "StatusBar1"
.Text = "StatusBar1"
.Align = DockStyle.alBottom
.SetBounds 0, 439, 734, 22
.Designer = @This
.Parent = @This
End With
' StatusPanel1
With StatusPanel1
.Name = "StatusPanel1"
.Designer = @This
.Parent = @StatusBar1
End With
' CheckBox1
With CheckBox1
.Name = "CheckBox1"
.Text = "CheckBox1"
.TabIndex = 9
.Visible = False
.SetBounds 0, 31, 150, 20
.Designer = @This
.Parent = @Panel2
End With
' CheckBox2
With CheckBox2
.Name = "CheckBox2"
.Text = "CheckBox2"
.TabIndex = 10
.Visible = False
.SetBounds 160, 31, 150, 20
.Designer = @This
.Parent = @Panel2
End With
' CheckBox3
With CheckBox3
.Name = "CheckBox3"
.Text = "Dark mode"
.TabIndex = 11
.Caption = "Dark mode"
.Checked = True
.SetBounds 80, 11, 70, 20
.Designer = @This
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As CheckBox), @CheckBox3_Click)
.Parent = @Panel2
End With
' ImageList1
With ImageList1
.Name = "ImageList1"
.SetBounds 0, 0, 16, 16
.Designer = @This
.Parent = @This
End With
End Constructor
Dim Shared frmUSUView As frmUSUViewType
#if _MAIN_FILE_ = __FILE__
App.DarkMode = True
frmUSUView.MainForm = True
frmUSUView.Show
App.Run
#endif
'#End Region
Private Sub frmUSUViewType.CommandButton_Click(ByRef Sender As Control)
Select Case Sender.Name
Case "cmdRefresh"
usbHostControllerEnum(@TreeView1, @TextBox1)
Case "cmdEnabled"
Case "cmdDisabled"
Case "cmdRemoved"
Case "cmdEject"
End Select
End Sub
Private Sub frmUSUViewType.CheckBox3_Click(ByRef Sender As CheckBox)
App.DarkMode= Sender.Checked
InvalidateRect(0, 0, True)
End Sub
Private Sub frmUSUViewType.TreeView1_SelChanged(ByRef Sender As TreeView, ByRef Item As TreeNode)
If Item.Name="" Then
TextBox1.Text = Item.Text & vbTab & Item.Name
Else
TextBox1.Text = Item.Text & vbTab & Item.Name & vbCrLf & *usbMessage(CInt(Item.Name))
End If
End Sub
Private Sub frmUSUViewType.Form_Show(ByRef Sender As Form)
CommandButton_Click(cmdRefresh)
End Sub
Private Sub frmUSUViewType.Form_Close(ByRef Sender As Form, ByRef Action As Integer)
usbTextRelease()
End Sub
Private Sub frmUSUViewType.Form_Create(ByRef Sender As Control)
Dim i As Long
Dim j As Long
Dim Icon As HICON
j = ExtractIconEx("C:\Windows\System32\setupapi.dll", -1, 0, 0, 1)
For i = 0 To j
ExtractIconEx("C:\Windows\System32\setupapi.dll", i, 0, @Icon, 1)
ImageList_ReplaceIcon(ImageList1.Handle, -1, Icon)
DestroyIcon Icon
Next
End Sub