VB怎么用WMP制作MP3播放器
VB怎么用WMP制作MP3播放器,要能读取列表到List1的,并能自动播放下首歌曲,还能保存列表到指定文件,并下次启动时,load事件读取到列表?源代码给我,我的QQ:9...
VB怎么用WMP制作MP3播放器,要能读取列表到List1的,并能自动播放下首歌曲,还能保存列表到指定文件,并下次启动时,load事件读取到列表?源代码给我,我的QQ:908187145,我的Email:laoluohacker@vip.qq.com
算了,源代码给我一份,然后在这也公布代码,让大家学习学习 展开
算了,源代码给我一份,然后在这也公布代码,让大家学习学习 展开
2个回答
展开全部
源代码已发
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 Command2_Click()
End Sub
Private Sub Command3_Click()
Timer1.Interval = 0
WindowsMediaPlayer1.Controls.stop
End Sub
Private Sub File1_Click()
If File1.ListCount > 0 Then
If Right(pb, 1) <> "\" Then
Label1.Caption = File1.Path & "\" & File1.FileName
WindowsMediaPlayer1.URL = Label1.Caption
End If
Else
Label1.Caption = pb & file.FileName
Label3.Caption = WindowsMediaPlayer1.currentMedia.durationString
End If
End Sub
Private Sub Form_Load()
If Dir(App.Path & "list.txt") = "" Then
Else
Open App.Path & "list.txt" For Input As #1
Line Input #1, a
File1.Path = a
End If
Close (1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "list.txt" For Output As #1
Print #1, File1.Path
Close (1)
End Sub
Private Sub Timer1_Timer()
Label2.Caption = "列表中共有" & File1.ListCount & "个"
If WindowsMediaPlayer1.playState = 1 Then
WindowsMediaPlayer1.URL = File1.List(File1.ListIndex + 1)
If File1.ListCount > File1.ListIndex + 1 Then
File1.ListIndex = File1.ListIndex + 1
End If
End If
WindowsMediaPlayer1.Controls.play
Label4.Caption = WindowsMediaPlayer1.Controls.currentPositionString
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 Command2_Click()
End Sub
Private Sub Command3_Click()
Timer1.Interval = 0
WindowsMediaPlayer1.Controls.stop
End Sub
Private Sub File1_Click()
If File1.ListCount > 0 Then
If Right(pb, 1) <> "\" Then
Label1.Caption = File1.Path & "\" & File1.FileName
WindowsMediaPlayer1.URL = Label1.Caption
End If
Else
Label1.Caption = pb & file.FileName
Label3.Caption = WindowsMediaPlayer1.currentMedia.durationString
End If
End Sub
Private Sub Form_Load()
If Dir(App.Path & "list.txt") = "" Then
Else
Open App.Path & "list.txt" For Input As #1
Line Input #1, a
File1.Path = a
End If
Close (1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Open App.Path & "list.txt" For Output As #1
Print #1, File1.Path
Close (1)
End Sub
Private Sub Timer1_Timer()
Label2.Caption = "列表中共有" & File1.ListCount & "个"
If WindowsMediaPlayer1.playState = 1 Then
WindowsMediaPlayer1.URL = File1.List(File1.ListIndex + 1)
If File1.ListCount > File1.ListIndex + 1 Then
File1.ListIndex = File1.ListIndex + 1
End If
End If
WindowsMediaPlayer1.Controls.play
Label4.Caption = WindowsMediaPlayer1.Controls.currentPositionString
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询