vb如何用MMControl获取mp3的信息?
vb如何用MMControl获取mp3的信息?像那些MP3播放器一样,能获取作者,标题,歌词等等的,怎么弄?...
vb如何用MMControl获取mp3的信息?
像那些MP3播放器一样,能获取作者,标题,歌词等等的,怎么弄? 展开
像那些MP3播放器一样,能获取作者,标题,歌词等等的,怎么弄? 展开
展开全部
'这里是用的直接读取mp3文件的方法
'这里没有处理数据,请自行处理
Private Type TagInfo'mp3的ID3v1,如不懂请查看相关信息
Tag As String * 3
Songname As String * 30
artist As String * 30
album As String * 30
pyear As String * 4
comment As String * 28
reserve As String * 1
track As String * 1
genre As Byte
End Type
Dim FileName As String
Dim CurrentTag As TagInfo'mp3的文件信息存储在这个变量中
Private Sub Command1_Click()'用一个按钮来处理
Dim temp As Byte
On Error Resume Next
Dim flTag As Long
FileName = "d:\1.mp3"'具体的文件自己修改
Open FileName For Binary As #1
With CurrentTag
flTag = FileLen(FileName) - 127
Get #1, flTag, .Tag
If Not .Tag = "TAG" Then
Label1.Caption = "No tag"
Close #1
Exit Sub
End If
Get #1, flTag + 3, .Songname
Get #1, flTag + 33, .artist
Get #1, flTag + 63, .album
Get #1, flTag + 93, .pyear
Get #1, flTag + 97, .comment
Get #1, flTag + 127, .genre
Close #1
End With
End Sub
'这里没有处理数据,请自行处理
Private Type TagInfo'mp3的ID3v1,如不懂请查看相关信息
Tag As String * 3
Songname As String * 30
artist As String * 30
album As String * 30
pyear As String * 4
comment As String * 28
reserve As String * 1
track As String * 1
genre As Byte
End Type
Dim FileName As String
Dim CurrentTag As TagInfo'mp3的文件信息存储在这个变量中
Private Sub Command1_Click()'用一个按钮来处理
Dim temp As Byte
On Error Resume Next
Dim flTag As Long
FileName = "d:\1.mp3"'具体的文件自己修改
Open FileName For Binary As #1
With CurrentTag
flTag = FileLen(FileName) - 127
Get #1, flTag, .Tag
If Not .Tag = "TAG" Then
Label1.Caption = "No tag"
Close #1
Exit Sub
End If
Get #1, flTag + 3, .Songname
Get #1, flTag + 33, .artist
Get #1, flTag + 63, .album
Get #1, flTag + 93, .pyear
Get #1, flTag + 97, .comment
Get #1, flTag + 127, .genre
Close #1
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询