如何写音乐播放器的程序
发布网友
发布时间:2022-04-23 16:35
我来回答
共1个回答
热心网友
时间:2022-05-05 03:14
添加一个 WindowsMediaPlayer,一个CommonDialog,一个list ,一个command
Dim pa As String
Private Sub Command1_Click()
Dim song As String
With CommonDialog1
.FileName = ""
.Filter = "*.MP3|*.mp3;*.avi;*.mid"
.Flags = 512
.ShowOpen
song = .FileName
End With
If song = "" Then Exit Sub
a = ""
For i = Len(song) To 1 Step -1
k = Mid(song, i, 1)
If k = " " Then '多首歌的分隔符
List1.AddItem a
a = ""
ElseIf k = "\" Then '一首歌时歌名与路径的分隔符
List1.AddItem a
pa = Left(song, i)
Exit Sub
Else
a = k & a
End If
Next i
End Sub
Private Sub List1_DblClick()
Me.Caption = "我的播放器 当前播放" & pa & List1.Text
WindowsMediaPlayer1.URL = pa & List1.Text
End Sub