05-15-2012، 02:24 PM
با سورس زیر میتوید تگ فایل mp3 از قبیل Artist و album و year و.... بیشتر شخصات یک فایل mp3 بدست بیارید.
سورس کد:
سورس کد:
کد:
Returning information on an MP3 file
The following function reads summary information stored in an MP3 file:
Option Explicit
Public Type MP3Info
Tag As String * 3
Songname As String * 30
Artist As String * 30
Album As String * 30
Year As String * 4
Comment As String * 30
Genre As String * 1
End Type
'Purpose : Returns a type containing information about an MP3 file
'Inputs : sFileName The path and file name of the MP3
'Outputs : Returns a type containing information about an MP3 file
Function MP3GetInfo(sFileName As String) As MP3Info
Dim sTemp As String, iFreeFile As Integer
On Error GoTo ErrFailed
iFreeFile = FreeFile
Open sFileName For Binary As iFreeFile
With MP3GetInfo
Get #1, FileLen(sFileName) - 127, .Tag
If Not .Tag = "TAG" Then
Debug.Print "No tag for " & sFileName
Else
Get #1, , .Songname
Get #1, , .Artist
Get #1, , .Album
Get #1, , .Year
Get #1, , .Comment
Get #1, , .Genre
End If
End With
Close iFreeFile
Exit Function
ErrFailed:
Debug.Print "Error in MP3GetInfo: " & Err.Description
Close iFreeFile
End Function