vb wmp多曲播放

PrivateSubForm_Load()Dima()Form1.AutoRedraw=TrueFile1.Path="D:\音乐\"File1.Pattern="*.m... Private Sub Form_Load()
Dim a()
Form1.AutoRedraw = True
File1.Path = "D:\音乐\"
File1.Pattern = "*.mp3;*.wma"
ReDim a(1 To File1.ListCount)
For i = 1 To File1.ListCount
a(i) = File1.Path & "\" & File1.List(i)
Print a(i)
Next
End Sub
怎样在双击listbox里的歌曲时,wmp自动全部播放(一个放完了接着放另一个)
展开
 我来答
popmoon
2011-12-26 · TA获得超过9994个赞
知道大有可为答主
回答量:4464
采纳率:30%
帮助的人:3526万
展开全部
修改了一下,再添加一个按钮、一个list、一个timer(enabled=false,interval=100、一个wmplayer
Private Sub Command1_Click()
WindowsMediaPlayer1.URL = List1.List(List1.ListIndex)
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Dim a()
Form1.AutoRedraw = True
File1.Path = "I:\Music\James_Last"
File1.Pattern = "*.mp3;*.wma"
ReDim a(0 To File1.ListCount - 1)

For i = 0 To File1.ListCount - 1
a(i) = File1.Path & "\" & File1.List(i)
List1.AddItem a(i)
Next

List1.ListIndex = 0
End Sub

Private Sub Timer1_Timer()
If List1.ListIndex = List1.ListCount - 1 Then Exit Sub
If WindowsMediaPlayer1.playState = wmppsStopped Then
List1.ListIndex = List1.ListIndex + 1
Command1_Click
End If
End Sub
更多追问追答
追问
我还想设置3个option,一个顺序播放,一个单曲循环,一个全循环,咋整?
追答
添加3个option:
Option1.Caption = "顺序播放"
Option2.Caption = "单曲播放"
Option3.Caption = "循环播放"
=====timer1的内容
Private Sub Timer1_Timer() '全循环播放

On Error GoTo prob
If Option1.Value = True And WindowsMediaPlayer1.playState = wmppsStopped Then
List1.ListIndex = List1.ListIndex + 1
Command1_Click
End If

If Option2.Value = True Then
Timer1.Enabled = False
WindowsMediaPlayer1.URL = List1.List(List1.ListIndex)
End If

If Option3.Value = True And WindowsMediaPlayer1.playState = wmppsStopped Then
If List1.ListIndex = List1.ListCount - 1 Then
List1.ListIndex = 0
Command1_Click
Else
List1.ListIndex = List1.ListIndex + 1
Command1_Click
End If
End If
prob:
Exit Sub
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式