📄 frmbrowse.frm
字号:
Key = ""
EndProperty
BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":9150
Key = ""
EndProperty
BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":95A4
Key = ""
EndProperty
BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":9A00
Key = ""
EndProperty
BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":9D1C
Key = ""
EndProperty
BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":A170
Key = ""
EndProperty
BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":A48C
Key = ""
EndProperty
BeginProperty ListImage39 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":A8E0
Key = ""
EndProperty
BeginProperty ListImage40 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":ABFC
Key = ""
EndProperty
BeginProperty ListImage41 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":B7D0
Key = ""
EndProperty
BeginProperty ListImage42 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":BAEC
Key = ""
EndProperty
BeginProperty ListImage43 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":BE08
Key = ""
EndProperty
BeginProperty ListImage44 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":C25C
Key = ""
EndProperty
BeginProperty ListImage45 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":C578
Key = ""
EndProperty
BeginProperty ListImage46 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":C9CC
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList IL1
Left = 6660
Top = 3960
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 9
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":CE20
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":D274
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":D6C8
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":DB1C
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":DF70
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":E3C4
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":E818
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":EC6C
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBrowse.frx":F0C0
Key = ""
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmBrowse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CurrentPath As String
Private Sub Form_Load()
tvTreeView.Nodes.Add , , "我的电脑", "我的电脑", 5
For i = 0 To Drive1.ListCount - 1
If i = Drive1.ListCount - 1 Then
tvTreeView.Nodes.Add 1, 4, Mid(Drive1.List(i), 1, 2), Mid(Drive1.List(i), 1, 2), 4
Else
tvTreeView.Nodes.Add 1, 4, Mid(Drive1.List(i), 1, 2), Mid(Drive1.List(i), 1, 2), 2
End If
Next i
End Sub
Private Sub Form_Resize()
On Error Resume Next
lvListView.Width = Me.Width - lvListView.Left - 150
lvListView.Height = Me.Height
tvTreeView.Height = Me.Height
End Sub
Private Sub lvListView_DblClick()
ShellFile CurrentPath, lvListView.SelectedItem.Text
End Sub
Private Sub tvTreeView_NodeClick(ByVal Node As MSComctlLib.Node)
On Error GoTo Err:
CurrentPath = Mid(Node.FullPath, 6)
Select Case Mid(Node.FullPath, 1, 4)
Case "我的电脑" 'Select Case 假如当前Node.Fullpath的头4个字符是“我的电脑”
If Node.Children = 0 Then '假如当前Node下没有子目录
Me.lvListView.ListItems.Clear
Path1.Path = CurrentPath & "\"
For i = 0 To Path1.ListCount - 1
'
tvTreeView.Nodes.Add Node.Key, 4, Path1.List(i), Mid(Path1.List(i), Len(Node.Key) + 2), 1
lvListView.ListItems.Add , , Mid(Path1.List(i), Len(Node.Key) + 2), 15
Next i
File1.Path = Path1.Path
ViewFile
'----------------------------------------------
Else '假如当前Node下有子目录
Path1.Path = CurrentPath & "\"
Me.lvListView.ListItems.Clear
For i = 0 To Path1.ListCount - 1
lvListView.ListItems.Add , , Mid(Path1.List(i), Len(Node.FullPath) - 3, Len(Path1.List(i))), 15
Next i
File1.Path = Path1.Path
ViewFile
End If
End Select
Err:
End Sub
Sub ViewFile()
With Me
Dim f As Integer
Dim FileType As String
For f = 0 To .File1.ListCount - 1
FileType = LCase$(Right(.File1.List(f), 3))
If FileType = "exe" Or FileType = "com" Then
.lvListView.ListItems.Add , , .File1.List(f), 2
ElseIf FileType = "txt" Then
.lvListView.ListItems.Add , , .File1.List(f), 3
ElseIf FileType = "bmp" Then
.lvListView.ListItems.Add , , .File1.List(f), 4
ElseIf FileType = "wav" Then
.lvListView.ListItems.Add , , .File1.List(f), 5
ElseIf FileType = "bat" Then
.lvListView.ListItems.Add , , .File1.List(f), 6
ElseIf FileType = "dll" Or FileType = "sys" Then
.lvListView.ListItems.Add , , .File1.List(f), 7
ElseIf FileType = "ini" Or FileType = "inf" Then
.lvListView.ListItems.Add , , .File1.List(f), 8
ElseIf FileType = "zip" Then
.lvListView.ListItems.Add , , .File1.List(f), 9
ElseIf FileType = "htm" Then
.lvListView.ListItems.Add , , .File1.List(f), 10
ElseIf FileType = "jpg" Then
.lvListView.ListItems.Add , , .File1.List(f), 11
ElseIf FileType = "gif" Then
.lvListView.ListItems.Add , , .File1.List(f), 12
ElseIf FileType = "reg" Then
.lvListView.ListItems.Add , , .File1.List(f), 13
ElseIf FileType = "avi" Then
.lvListView.ListItems.Add , , .File1.List(f), 14
ElseIf FileType = "pif" Then
.lvListView.ListItems.Add , , .File1.List(f), 16
ElseIf FileType = "scr" Then
.lvListView.ListItems.Add , , .File1.List(f), 17
ElseIf FileType = "mp3" Then
.lvListView.ListItems.Add , , .File1.List(f), 18
ElseIf FileType = "cpl" Then
.lvListView.ListItems.Add , , .File1.List(f), 7
Else
.lvListView.ListItems.Add , , .File1.List(f), 1
End If
Next f
End With
End Sub
Sub ShellFile(FNPath As String, FN As String)
FN = LCase$(FN)
If Right(FNPath, 1) <> "\" Then: FNPath = FNPath & "\"
If FN = "explorer.exe" Then
MsgBox "此文件禁用!", vbInformation, "提示"
Exit Sub
End If
If Right(FN, 3) = "exe" Or Right(FN, 3) = "bat" Or Right(FN, 3) = "com" Then
Shell FNPath & FN, vbNormalFocus
Else
MsgBox "不是可执行文件", vbInformation, "提示 "
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -