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自动全部播放(一个放完了接着放另一个) 展开
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自动全部播放(一个放完了接着放另一个) 展开
1个回答
展开全部
修改了一下,再添加一个按钮、一个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
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
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询