📄 open.frm
字号:
VERSION 5.00
Begin VB.Form Dialog9
BorderStyle = 3 'Fixed Dialog
Caption = "视频文件"
ClientHeight = 5745
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 6000
Icon = "Open.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5745
ScaleWidth = 6000
ShowInTaskbar = 0 'False
Begin VB.ComboBox Combo1
Height = 300
Left = 0
TabIndex = 7
Text = "Combo1"
Top = 4800
Width = 2535
End
Begin VB.CommandButton Command3
Caption = "另存为播放列表"
Height = 375
Left = 4800
TabIndex = 6
Top = 5280
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3600
TabIndex = 5
Top = 5280
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 2400
TabIndex = 4
Top = 5280
Width = 1095
End
Begin VB.DriveListBox Drive1
Height = 300
Left = 0
TabIndex = 3
Top = 4440
Width = 2535
End
Begin VB.DirListBox Dir1
Height = 5130
Left = 2640
TabIndex = 2
Top = 0
Width = 3255
End
Begin VB.FileListBox File1
Height = 3870
Left = 0
MultiSelect = 2 'Extended
TabIndex = 1
Top = 480
Width = 2535
End
Begin VB.TextBox Text1
Height = 375
Left = 0
TabIndex = 0
Text = "Text1"
Top = 0
Width = 2535
End
End
Attribute VB_Name = "Dialog9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Dim i As Integer
Private Sub Combo1_Click()
'Dim index As Integer
File1.Pattern = Combo1.Text
End Sub
Private Sub Command1_Click()
On Error Resume Next
Static t As Boolean
Dim index As Integer
t = Not t
i = 0
index = File1.ListCount
Form1.MMControl1.Command = "Stop"
Form1.MMControl1.Command = "Close"
For x = 1 To 50
Unload Form1.meu(x)
Next x
If Text1.Text <> "" Then
For index = 0 To index - 1
If File1.Selected(index) Then '//如果被选中则添加到曲目列表
Form1.meu(i).Checked = False
i = i + 1
Load Form1.meu(i)
Form1.meu(i).Caption = Dir1.Path & "\" & File1.List(index)
End If
Next index
Form1.Label2.Caption = "总曲目数:" & i
Form1.meuPlayFile.Visible = True
Form7.WMP.URL = Form1.meu(1).Caption
'Form1.Timer2.Enabled = True '//定时器有效
Form1.meu(1).Checked = True
Form1.Label7.Caption = "Super Player 9.0 正在播放:" & Form7.WMP.URL
' Form1.MMControl1.Command = "Open"
' Form1.MMControl1.Command = "Play"
' Form1.MMControl1.UpdateInterval = 1000
Form1.Slider1.Enabled = True
Form1.meuPlayList.Visible = False
Form1.meuCDQuMu.Visible = False
Form1.meuMusic.Visible = False
x = Drive1.Drive
y = Dir1.Path
Open App.Path & "\temp\dir_2" For Output As #1 '有何用处,缺少为何无法写入
Print #1, ""
Close #1
Open App.Path & "\temp\dir_2" For Output As #1 '将打开的路径保存
Print #1, x
'Print #1, ""
Print #1, y
Close #1
Open App.Path & "\temp\Music.m3u" For Output As #1
For x = 1 To 40
Print #1, Form1.meu(x).Caption
If Form1.meu(x).Caption = "" Then Exit For
Next x
Close #1
'Form1.WindowState = 1
Form7.Show
Form1.meuFull.Enabled = True
Unload Form2
Unload Me
Else
DoEvents
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
On Error Resume Next
With Cmd1
.FileName = "播放列表"
.DialogTitle = "另存为播放列表"
.Filter = "播放列表(*.m3u)|*.m3u|All Files(*.*)|*.*|"
.CancelError = True
.ShowSave
If Err.Number = cdlCancel Then
Dialog9.SetFocus
Exit Sub
End If
Open Cmd1.FileName For Output As #1
If Text1.Text <> "" Then
For index = 0 To File1.ListCount - 1
If File1.Selected(index) Then '//如果被选中则添加到曲目列表
'i = i + 1
Print #1, Dir1.Path & "\" & File1.List(index)
End If
Next index
End If
Close #1
End With
Dialog9.SetFocus
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
'Label5.Caption = "文件夹:" & Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo errorlabel
Dir1.Path = Drive1.Drive
' Label3.Caption = "驱动器:" & Drive1.Drive
Exit Sub
errorlabel: MsgBox "设备可能未准备好,请准备好再试.", vbExclamation, "提示"
End Sub
Private Sub File1_Click()
Text1.Text = Text1.Text & " " & File1.FileName
End Sub
Private Sub File1_DblClick()
On Error Resume Next
For x = 2 To 50
Unload Form1.meu(x)
Next x
Form1.meuPlayFile.Visible = True
With Form1.MMControl1
.Command = "Close"
Form7.WMP.URL = Dir1.Path & "\" & File1.FileName
'.Command = "Open"
'.Command = "Play"
'.UpdateInterval = 1000
End With
Open App.Path & "\temp\dir_2" For Output As #1 '有何用处,缺少为何无法写入
Print #1, ""
Close #1
Open App.Path & "\temp\dir_2" For Output As #1 '将打开的路径保存
Print #1, x
'Print #1, ""
Print #1, y
Close #1
Form1.meuPlayList.Visible = False
Form1.meuCDQuMu.Visible = False
Form1.meuMusic.Visible = False
Form1.meu(1).Caption = Form7.WMP.URL
Form7.Show
Form1.meuFull.Enabled = True
Unload Dialog9
Form1.Label7.Caption = "Super Player 9.0 正在播放:" & Form7.WMP.URL
End Sub
Private Sub File1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 And KeyCode = vbKeyA Then
For index = 0 To File1.ListCount - 1
File1.Selected(index) = True
Text1.Text = Text1.Text & File1.List(index)
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 File1_KeyUp(KeyCode As Integer, Shift As Integer)
'On Error Resume Next
'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 Form_Load()
On Error Resume Next
Text1.Text = ""
'Label3.Caption = "驱动器:" & Drive1.Drive
'Label5.Caption = "文件夹:" & Dir1.Path
File1.Pattern = "*.MPG;*.avi;*.DAT;*.mp4;*.mpga;*.mpeg"
'Label2.Caption = "所有支持的媒体文件" '//支持格式
'Drive1.Drive = "F:\"
'Dir1.Path = "F:\"
With Dialog9.Combo1
.Text = "*.MPG;*.avi;*.DAT;*.mp4;*.mpga;*.mpeg"
.AddItem "*.MPG;*.avi;*.DAT;*.mp4;*.mpga;*.mpeg"
.AddItem "*.Dat"
.AddItem "*.Mpg"
.AddItem "*.*"
End With
Open App.Path & "\temp\dir_2" For Input As #1 '将上次打开的路径读入
Do While Not EOF(1)
Line Input #1, nextline
If nextline = "" Then
Exit Sub '为空则退出
Else
Seek #1, 0
Line Input #1, nextline
Dir1.Path = nextline
nextline = ""
Seek #1, 1
Line Input #1, nextline
Drive1.Drive = nextline
End If
Exit Sub
Loop
Close #1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -