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