vb 音乐播放器不能自动播放下一首。

DimabAsStringPrivateSubCommand1_Click()DimsongAsStringWithCommonDialog1.FontName="".F... Dim ab As String
Private Sub Command1_Click()
Dim song As String
With CommonDialog1
.FontName = ""
.Filter = "*.mp3|*.mp3;*.wma|*.wma;*.avi|*.avi"
.ShowOpen
song = .FileName
End With
If song = "" Then Exit Sub
a = ""
For i = Len(song) To 1 Step -1
b = Mid(song, i, 1)
If b = "" Then
List1.AddItem a
a = ""
ElseIf b = "\" Then
List1.AddItem a
ab = Left(song, i)
Exit Sub
Else
a = b & a
End If
Next i
End Sub
Private Sub Command2_Click()
If List1.ListIndex = 0 Then
Label2.Caption = "第一个"
Else
List1.ListIndex = List1.ListIndex - 1
WindowsMediaPlayer1.URL = ab & List1.Text
End If
End Sub
Private Sub Command3_Click()
If List1.ListCount - 1 <> List1.ListIndex Then
List1.ListIndex = List1.ListIndex + 1
WindowsMediaPlayer1.URL = ab & List1.Text
Else
Label2.Caption = "最后一个"
End If
End Sub

Private Sub Command4_Click()
WindowsMediaPlayer1.URL = ab & List1.Text
End Sub

Private Sub Form_Load() '打开程序时自动打开保存的文件名及路径
Dim ss As String
List1.Clear
If Dir(App.Path & "\MusicList.txt") <> "" Then
Open App.Path & "\MusicList.txt" For Input As #1
If Not EOF(1) Then
Line Input #1, ab
Do Until EOF(1)
Line Input #1, ss
List1.AddItem ss
Loop
End If
Close #1
End If
End Sub

Private Sub Form_Unload(Cancel As Integer) '退出程序时保存文件名及路径
Dim i As Long
Open App.Path & "\MusicList.txt" For Output As #1
Print #1, ab
For i = 0 To List1.ListCount - 1
Print #1, List1.List(i)
Next
Close #1
End Sub

Private Sub List1_DblClick()
Form1.Caption = "播放列表" + ab & List1.Text
WindowsMediaPlayer1.URL = ab & List1.Text
End Sub

Public Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
If WindowsMediaPlayer1.playState = wmppsMediaEnded Then
List1.ListIndex = List1.ListIndex + 1
List1_DblClick
End If
End Sub
展开
 我来答
人参和醋不相逢9527
2011-09-17 · TA获得超过104个赞
知道小有建树答主
回答量:244
采纳率:0%
帮助的人:106万
展开全部
Private Sub MediaPlayer1_EndOfStream(ByVal Result As Long)
If Me.XPRadioButton1.Value = True Then '循环播放
If Me.List1.ListIndex = Me.List1.ListCount - 1 Then
List1.ListIndex = 0
Else
Me.List1.ListIndex = Me.List1.ListIndex + 1
End If
End If

If Me.XPRadioButton2.Value = True Then '只播放一次
If Me.List1.ListIndex = Me.List1.ListCount - 1 Then
Me.MediaPlayer1.Stop
Else
Me.List1.ListIndex = List1.ListIndex + 1
End If
End If
更多追问追答
追问
我用的是 WindowsMediaPlayer 
那个方法不管用
追答
我用的就是WindowsMediaPlayer呀,你只要把要播放的文件添加到LIST1中,选择任一个文件播放完后就可自动播放下一个的,我一直在用的。
wynness
2011-09-17 · TA获得超过1676个赞
知道小有建树答主
回答量:2245
采纳率:50%
帮助的人:1216万
展开全部
自动播放下一首有个common事件的。程序在里面写
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式