vb 如何用Windowsmediaplayer做循环播放
现有代码:PrivateSubWMP1_PlayStateChange(ByValNewStateAsLong)OnErrorGoTo1'全部循环IfNewState=1...
现有代码:
Private Sub WMP1_PlayStateChange(ByVal NewState As Long)
On Error GoTo 1
'全部循环
If NewState = 1 And Form2.Option1.Value = True Then
Dim i As Integer
For i = 1 To Form2.ListView1.ListItems.Count
If Form2.ListView1.ListItems(i).SubItems(1) = WMP1.URL Then
WMP1.URL = Form2.ListView1.ListItems(i + 1).SubItems(1)
Form2.Text1.Text = WMP1.URL
WMP1.Controls.stop
Debug.Print Form2.Text1.Text
WMP1.Controls.play
End If
Next i
End If
1:
If Err.Number = 35600 Then
WMP1.URL = Form2.ListView1.ListItems(1).SubItems(1)
Form2.Text1.Text = WMP1.URL
Debug.Print WMP1.URL
WMP1.Controls.stop
WMP1.Controls.play
End If
End Sub
但不能实现功能,怎样修改? 展开
Private Sub WMP1_PlayStateChange(ByVal NewState As Long)
On Error GoTo 1
'全部循环
If NewState = 1 And Form2.Option1.Value = True Then
Dim i As Integer
For i = 1 To Form2.ListView1.ListItems.Count
If Form2.ListView1.ListItems(i).SubItems(1) = WMP1.URL Then
WMP1.URL = Form2.ListView1.ListItems(i + 1).SubItems(1)
Form2.Text1.Text = WMP1.URL
WMP1.Controls.stop
Debug.Print Form2.Text1.Text
WMP1.Controls.play
End If
Next i
End If
1:
If Err.Number = 35600 Then
WMP1.URL = Form2.ListView1.ListItems(1).SubItems(1)
Form2.Text1.Text = WMP1.URL
Debug.Print WMP1.URL
WMP1.Controls.stop
WMP1.Controls.play
End If
End Sub
但不能实现功能,怎样修改? 展开
3个回答
展开全部
private sub Form_Load()
WindowsMediaPlayer1.URL = "music\排行榜.mp3"
WindowsMediaPlayer1.Controls.play
Timer1.Enabled = True
End sub
Private Sub Timer1_Timer()
If Me.WindowsMediaPlayer1.playState = 1 Then'1为停止播放
Me.WindowsMediaPlayer1.URL = "音乐文件地址"
Me.WindowsMediaPlayer1.Controls.play
End If
End Sub
注意要设置时间控件timer1的interval属性,可取20
展开全部
'如果是用的Windows MediaPlayer 就可以在里面加这样一段代码
'当播放器的播放状态改变是:
Private Sub MediaPlayer1_PlayStateChange(ByVal NewState As Long)
If NewState = 1 Then'1为停止(一曲播完)
MediaPlayer1.Controls.play'再播放
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
WindowsMediaPlayer1.URL = App.Path & "\BGM.wav"
WindowsMediaPlayer1.settings.setMode "loop", True
WindowsMediaPlayer1.settings.setMode "loop", True
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询