📄 myfile.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Dialog9
BorderStyle = 3 'Fixed Dialog
Caption = "对话框标题"
ClientHeight = 5505
ClientLeft = 2760
ClientTop = 3645
ClientWidth = 6705
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "MyFile.frx":0000
ScaleHeight = 5505
ScaleWidth = 6705
ShowInTaskbar = 0 'False
Begin MSComDlg.CommonDialog cdg
Left = 3600
Top = 4920
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "播放选中项"
Height = 375
Index = 10
Left = 5280
TabIndex = 9
Top = 3840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "取 消"
Height = 375
Index = 9
Left = 5280
TabIndex = 8
Top = 4800
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "全部播放"
Height = 375
Index = 8
Left = 5280
TabIndex = 7
Top = 4320
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "清 除"
Height = 375
Index = 5
Left = 5280
TabIndex = 6
Top = 3000
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "删除未选项"
Height = 375
Index = 4
Left = 5280
TabIndex = 5
Top = 2520
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "删除被选项"
Height = 375
Index = 3
Left = 5280
TabIndex = 4
Top = 2040
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "保存列表"
Height = 375
Index = 2
Left = 5280
TabIndex = 3
Top = 1320
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "读取列表"
Height = 375
Index = 1
Left = 5280
TabIndex = 2
Top = 840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "添加文件"
Height = 375
Index = 0
Left = 5280
TabIndex = 1
Top = 120
Width = 1335
End
Begin VB.ListBox List1
Height = 5460
Left = 0
MultiSelect = 2 'Extended
Sorted = -1 'True
TabIndex = 0
Top = 0
Width = 5175
End
End
Attribute VB_Name = "Dialog9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click(index As Integer)
On Error Resume Next
Dim strm3u As String
Dim nextline As String
Dim i As Integer
i = 0
Dim strFile() As String
Select Case index
Case 0
Dialog6.Show
Case 1
Err.Clear
With cdg
.DialogTitle = "读取文件"
.CancelError = True
.Filter = "M3U文件(*.m3u)|*.M3U|"
.ShowOpen
If Err.Number = cdlCancel Then Exit Sub
strm3u = ""
strm3u = cdg.FileName
End With
If Dir(strm3u) = "" Or FileLen(strm3u) = 0 Then Exit Sub
Open strm3u For Input As #1
Do While Not EOF(1)
Line Input #1, nextline
List1.AddItem nextline
Loop
Close #1
Case 2
Err.Clear
With cdg
.DialogTitle = "保存文件"
.CancelError = True
.Filter = "M3U文件(*.m3u)|*.M3U|"
.ShowOpen
If Err.Number = cdlCancel Then Exit Sub
strm3u = ""
End With
If List1.ListIndex = -1 Then Exit Sub
strm3u = cdg.FileName
Open strm3u For Output As #2
For x = 0 To List1.ListCount - 1
Print #2, List1.List(x)
Next x
Close #2
Case 3
ReDim strFile(1 To List1.ListCount - List1.SelCount)
i = 0
For s = 0 To List1.ListCount - 1
If List1.Selected(s) = False Then
i = i + 1
strFile(i) = List1.List(s)
End If
Next s
Cout = List1.ListCount - List1.SelCount
List1.Clear
For x = 1 To Cout
List1.AddItem strFile(x)
Next x
Case 4
ReDim strFile(1 To List1.SelCount)
i = 0
For s = 0 To List1.ListCount - 1
If List1.Selected(s) = True Then
i = i + 1
strFile(i) = List1.List(s)
' List1.RemoveItem List1.List(Index)
End If
Next s
Cout = List1.SelCount
List1.Clear
For x = 1 To Cout
List1.AddItem strFile(x)
Next x
Case 5
List1.Clear
' Case 6
'If List1.ListIndex - 1 < 0 Or List1.Text = "" Then Exit Sub
'List1.AddItem List1.Text, List1.ListIndex + 1
'List1.RemoveItem List1.ListIndex
'Case 7
'If List1.ListIndex + 1 > (List1.ListCount - 1) Or List1.Text = "" Then Exit Sub
'List1.AddItem List1.Text, List1.ListIndex - 1
'List1.h
'List1.RemoveItem List1.ListIndex
Case 8
Form1.meuPlayFile.Visible = True
Form1.meuPlayList.Visible = False
Form1.meuMusic.Visible = False
Form1.meuCDQuMu.Visible = False
Form1.MMControl1.Command = "Stop"
Form1.MMControl1.Command = "Close"
For x = 0 To 50
Unload Form1.meu(x)
Form1.meu(x).Checked = False
Next x
For x = 0 To 24
Form1.Label8(x).Enabled = False
Next x
For x = 0 To List1.ListCount - 1
Load Form1.meu(x + 1)
Form1.meu(x + 1).Caption = List1.List(x)
Form1.Label8(x).Enabled = True
Next x
Form1.MMControl1.FileName = Form1.meu(1).Caption
Form1.meu(1).Checked = True
Form1.MMControl1.Command = "Open"
Form1.MMControl1.Command = "Play"
Form1.MMControl1.UpdateInterval = 1000
If Form1.MMControl1.Mode <> 526 Then
MsgBox "未装声卡或驱动程序未正确安装或未加载", vbInformation + vbOKOnly, "提示"
End If
Unload Dialog9
'Set Dialog9 = Nothing
Case 9
Unload Dialog9
'Set Dialog9 = Nothing
Case 10
Form1.meuPlayFile.Visible = True
Form1.meuPlayList.Visible = False
Form1.meuMusic.Visible = False
Form1.meuCDQuMu.Visible = False
Form1.MMControl1.Command = "Stop"
Form1.MMControl1.Command = "Close"
For x = 0 To 50
Unload Form1.meu(x)
Form1.meu(x).Checked = False
Next x
For x = 0 To 24
Form1.Label8(x).Enabled = False
Next x
For x = 0 To List1.ListCount - 1
If List1.Selected(x) = True Then
i = i + 1
Load Form1.meu(i)
Form1.Label8(i - 1).Enabled = True
Form1.meu(i).Caption = List1.List(x)
End If
Next x
Form1.MMControl1.FileName = Form1.meu(1).Caption
Form1.meu(1).Checked = True
Form1.MMControl1.Command = "Open"
Form1.MMControl1.Command = "Play"
Form1.MMControl1.UpdateInterval = 1000
If Form1.MMControl1.Mode <> 526 Then
MsgBox "未装声卡或驱动程序未正确安装或未加载", vbInformation + vbOKOnly, "提示"
End If
Unload Dialog9
'Set Dialog9 = Nothing
End Select
End Sub
Private Sub Form_Load()
Dim x As Integer
On Error Resume Next
If Form1.meuPlayFile.Visible = True Then
For x = 1 To 50
If Form1.meu(x).Caption <> "" Then
List1.AddItem Form1.meu(x).Caption
End If
Next x
End If
If Form1.meuPlayList.Visible = True Then
For x = 0 To 50
If Form1.meu2(x).Caption <> "" Then
List1.AddItem Form1.meu2(x).Caption
End If
Next x
End If
If Form1.meuMusic.Visible = True Then
For x = 0 To 30
If Form1.meuQuMu(x).Caption <> "" Then
List1.AddItem Form1.meuQuMu(x).Caption
End If
Next x
End If
If Form1.meuCDQuMu.Visible = True Then
For x = 0 To 30
If Form1.meuCDQ(x).Caption <> "" Then
List1.AddItem Form1.meuCDQ(x).Caption
End If
Next x
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set Dialog9 = Nothing '//防止内存卸漏
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -