VB 做音乐播放器,播放列表怎么弄?
2个回答
展开全部
添加一个file ,按钮,wmp控件,timer(这能制动播放下一首)
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pIdl As Long, ByVal pszPath As String) As Long
Private Type BrowseInfo
hwndOwner As Long
piDLroot As Long
pszdisplayName As String
lpsztitle As String
ulFlags As Long
lpfncallback As Long
lParam As Long
iImage As Long
End Type
Private Sub Command1_Click()
Dim bi As BrowseInfo
Dim folderid As Long
Dim pb As String
With bi
.hwndOwner = Me.hWnd
.lpsztitle = "把输出的文件存放到这个文件夹:"
.ulFlags = 3
End With
folderid = SHBrowseForFolder(bi)
If folderid = 0 Then Exit Sub
pb = String$(260, 0)
SHGetPathFromIDList folderid, pb
pb = Left$(pb, InStr(pb, vbNullChar) - 1)
File1.Path = pb
End Sub
Private Sub file1_Click()
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.FileName
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
If WindowsMediaPlayer1.playState = 1 Then
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.List(File1.ListIndex + 1)
If File1.ListCount > File1.ListIndex + 1 Then
File1.ListIndex = File1.ListIndex + 1
End If
End If
End Sub
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pIdl As Long, ByVal pszPath As String) As Long
Private Type BrowseInfo
hwndOwner As Long
piDLroot As Long
pszdisplayName As String
lpsztitle As String
ulFlags As Long
lpfncallback As Long
lParam As Long
iImage As Long
End Type
Private Sub Command1_Click()
Dim bi As BrowseInfo
Dim folderid As Long
Dim pb As String
With bi
.hwndOwner = Me.hWnd
.lpsztitle = "把输出的文件存放到这个文件夹:"
.ulFlags = 3
End With
folderid = SHBrowseForFolder(bi)
If folderid = 0 Then Exit Sub
pb = String$(260, 0)
SHGetPathFromIDList folderid, pb
pb = Left$(pb, InStr(pb, vbNullChar) - 1)
File1.Path = pb
End Sub
Private Sub file1_Click()
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.FileName
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
If WindowsMediaPlayer1.playState = 1 Then
WindowsMediaPlayer1.URL = File1.Path & "\" & File1.List(File1.ListIndex + 1)
If File1.ListCount > File1.ListIndex + 1 Then
File1.ListIndex = File1.ListIndex + 1
End If
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询