Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MP3 Tag Information 1

Status
Not open for further replies.

Shake412

Programmer
Apr 17, 2002
55
GB
Does anyone know how I can access and update the MP3 tag information using VB/VBA.

Thanks
 
'Place a command button and a text box on a form
'Remove Text1 from the Text property
'Set the Text box to multiline and scrollbars to both
'Place everything belwo into the click event of Command1


Dim fNum As Integer
Dim sTagIdent As String * 3
Dim sTitle As String * 30
Dim sArtist As String * 30
Dim sAlbum As String * 30
Dim sYear As String * 4
Dim sComment As String * 30
fNum = FreeFile

'Change this to your file path
Open "D:\Inetpub\Visual Basic\VectorTop10\1.mp3" For Binary As fNum

Seek #fNum, LOF(fNum) - 127
Get #fNum, , sTagIdent
If sTagIdent = "TAG" Then
Get #fNum, , sTitle
Get #fNum, , sArtist
Get #fNum, , sAlbum
Get #fNum, , sYear
Get #fNum, , sComment
End If
Close #fNum

'This will display the info into a text box, in this case named Text1.Text
Text1.Text = sTitle & "," & sArtist & "," & sAlbum & "," & sYear & "," & sComment


'This next one displays a msgbox with the ID info, jsy remove the comment tag
'MsgBox sTitle & "," & sArtist & "," & sAlbum & "," & sYear & "," & sComment

Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
i have a question of similar type. its about image editing. i want to add just one alphabet (like "a") to the end of teh image file. but the problem is once i open it and add the "a" in notepad it says file corrupted. i found out that the problem was the editor(notepad - some bits or something like that). does ur code also work for images?

Known is handfull, Unknown is worldfull
 
vbkris, Are you meaning that you want to rename your Image file? If so I can give you the code for that.


Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
not rename, change the cntent of the file...

Known is handfull, Unknown is worldfull
 
Right so let me get this right. You have an image file and you would like to add a letter into the image so that this letter is visible when you open the image in say MS Paint? Or that when you open the image in notepad you wish to add a letter to the end of all of the text you see on screen.

If it is the first then it will depend on if you want the letter to be added at exactly the same place each time.

If it is the second one then if you let us know why you need that doing we may be able to offer a better solution.

Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
that letter is being added to the file to sort of corrupt it. i dont want to display the letter on the image. lets say the content of an image file is (in byte code):
@#$#@%#$^@@~!$^*

then i want to add a letter to it:
@#$#@%#$^@@~!$^*A

i dont want this letter to be displayed on the image but corrupt the file...

Note: this is not for hacking. so dont worry...

Known is handfull, Unknown is worldfull
 
vbkris
The following code will add a letter to the end of the file. However it does not corrupt it so you can not see the image.

Private Sub Command1_Click()
Dim strInput As String
strInput = "a"
Open "c:\example.bmp" For Append As #1
Print #1, strInput
Close #1
End Sub


Greg Palmer

----------------------------------------
Any feed back is appreciated.
 
hi,
ur code seems simple. i do not have VB with me right now. i will test it, but i also want u to do something for me. reverse the process (ie remove the A from the file). now try opeening the file in paint. does it open?

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top