展开全部
一个按钮,一个文本框用于输入文件夹地址(要正确输入,不要加引号),一个WMP,一个文件列表框
Dim i%
Private Sub Command1_Click()
On Error GoTo userCanceled
File1.Path = Text1.Text
If File1.ListCount < 2 Then Exit Sub
i = Int((File1.ListCount - 1) * Rnd)
File1.Selected(i) = True
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.FileName
userCanceled:
End Sub
Private Sub Form_Load()
File1.Pattern = "*.AVI;*.MOV;*.DAT;*.MPG;*.WAV;*.MID;*.QT;*.MPEG;*.F4V" & _
";*.RM;*.RMVB;*.WMV;*.FLV;*.3GP;*.MP4;*.MP3;*.ASF;*.WMA;*.MKV;*.BC!"
End Sub
Private Sub WindowsMediaPlayer1_MediaChange(ByVal Item As Object)
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case Is = wmppsMediaEnded
WindowsMediaPlayer1.Controls.play
i = Int((File1.ListCount - 1) * Rnd)
File1.Selected(i) = True
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.FileName
End Select
End Sub
Dim i%
Private Sub Command1_Click()
On Error GoTo userCanceled
File1.Path = Text1.Text
If File1.ListCount < 2 Then Exit Sub
i = Int((File1.ListCount - 1) * Rnd)
File1.Selected(i) = True
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.FileName
userCanceled:
End Sub
Private Sub Form_Load()
File1.Pattern = "*.AVI;*.MOV;*.DAT;*.MPG;*.WAV;*.MID;*.QT;*.MPEG;*.F4V" & _
";*.RM;*.RMVB;*.WMV;*.FLV;*.3GP;*.MP4;*.MP3;*.ASF;*.WMA;*.MKV;*.BC!"
End Sub
Private Sub WindowsMediaPlayer1_MediaChange(ByVal Item As Object)
WindowsMediaPlayer1.Controls.play
End Sub
Private Sub WindowsMediaPlayer1_PlayStateChange(ByVal NewState As Long)
Select Case NewState
Case Is = wmppsMediaEnded
WindowsMediaPlayer1.Controls.play
i = Int((File1.ListCount - 1) * Rnd)
File1.Selected(i) = True
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.FileName
End Select
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询