📄 add_file.frm
字号:
VERSION 5.00
Begin VB.Form Dialog8
BorderStyle = 3 'Fixed Dialog
Caption = "添加文件"
ClientHeight = 3930
ClientLeft = 2760
ClientTop = 3645
ClientWidth = 6165
Icon = "Add_File.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "Add_File.frx":1272
ScaleHeight = 3930
ScaleWidth = 6165
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 375
Left = 5040
TabIndex = 4
Top = 600
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Height = 375
Left = 5040
TabIndex = 3
Top = 120
Width = 1095
End
Begin VB.DirListBox Dir1
Height = 3870
Left = 2520
TabIndex = 2
Top = 0
Width = 2415
End
Begin VB.FileListBox File1
Height = 3510
Left = 0
MultiSelect = 2 'Extended
TabIndex = 1
Top = 360
Width = 2415
End
Begin VB.DriveListBox Drive1
Height = 300
Left = 0
TabIndex = 0
Top = 0
Width = 2415
End
Begin VB.Label Label1
Caption = "注意添加的文件名中不可以有逗号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1815
Left = 5160
TabIndex = 5
Top = 1200
Width = 975
End
End
Attribute VB_Name = "Dialog8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
Dim strmname As String
Dim nextline As String
Dim strErr As String
Dim strInput As String
Dim strFile As String
Form6.List1.Clear
Open App.Path & "\temp\" & Form6.TreeView1.SelectedItem.Text & ".m3u" For Append As #1
For index = 0 To File1.ListCount - 1
If File1.Selected(index) Then
strFile = File1.List(index)
errlabel: Err.Clear '//清除Err.对象
Form6.TreeView1.Nodes.Add Form6.TreeView1.SelectedItem.Text, tvwChild, strFile, strFile, 15
'//防止索引号重复
If Err.Number = 35602 Then
strErr = MsgBox(strFile & " 这个索引号已被使用或该文件已被添加," & Chr(10) + Chr(13) & "你是否一定要重新添加该结点或文件", vbExclamation + vbYesNo, "提示")
If strErr = vbYes Then
strInput = InputBox("请输入将" & strFile & "重命名,可以在文件名后加数字", "重命名", strFile)
If strInput <> "" Or strInput <> strFile Then
strFile = strInput
GoTo errlabel
Else
GoTo errline
End If
ElseIf strErr = vbNo Then
GoTo errline
End If
End If
strmname = Dir1.Path & "\" & File1.List(index)
'Form6.List1.AddItem strmname
Print #1, strmname
End If
errline: Next index
Close #1
Open App.Path & "\temp\" & Form6.TreeView1.SelectedItem.Text & ".m3u" For Input As #2
Do While Not EOF(2)
Line Input #2, nextline
Form6.List1.AddItem nextline
Loop
Close #2
Form6.TreeView1.SelectedItem.Expanded = True
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
Set Dialog3 = Nothing
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo errorlabel
Dir1.Path = Drive1.Drive
Exit Sub
errorlabel: MsgBox "设备可能未准备好,请准备好再试.", vbExclamation, "提示"
End Sub
Private Sub File1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim index As Integer
index = 0
If Shift = 2 And KeyCode = vbKeyA Then
For index = 0 To File1.ListCount - 1
File1.Selected(index) = True
Next index
End If
End Sub
Private Sub File1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
File1.Pattern = "*.Mp3;*.MPEG;*.mpg;*.avi;*.wav;*.DAT;*.WM;*.Wma;*.midi;*.mid;*.mps;*.mp4;*.mpga;*.mp1;*.mp2;*.pls;*.xpl;*.AU"
Open App.Path & "\temp\dir" For Input As #1 '将上次打开的路径读入
Do While Not EOF(1)
Line Input #1, nextline
If nextline = "" Then
Close #1
Exit Sub '为空则退出
Else
Seek #1, 0
Line Input #1, nextline
Dir1.Path = nextline
nextline = ""
Seek #1, 1
Line Input #1, nextline
Drive1.Drive = nextline
Exit Do
End If
Loop
Close #1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -