Reading ID3 tags with Shell32
-
I came across this article http://www.codeproject.com/csharp/ShellID3TagReader.asp[^] and so I tried doing exactly as shown but it's not working. When the
folder.GetDetailsOf
function returns it's blank but I know for a fact that there this mp3 has an ID3 tag. Furthermore when I add the extra columns in Windows Explorer to see the mp3 info it doesn't display anything. Can myShell32
be broken somehow? Here's the code I have (even though it's the same in the article):MP3File mp3File = new MP3File(); string fileName = FilePath.Substring(FilePath.LastIndexOf("\\") + 1); string filePath = FilePath.Substring(0, FilePath.LastIndexOf("\\")); Shell32.Shell shell = new Shell32.ShellClass(); Shell32.Folder folder = shell.NameSpace(filePath); Shell32.FolderItem folderItem = folder.ParseName(fileName); if(folderItem != null) { mp3File.FileName = fileName; mp3File.AlbumName = folder.GetDetailsOf(folderItem, 17); mp3File.ArtistName = folder.GetDetailsOf(folderItem, 16); mp3File.SongTitle = folder.GetDetailsOf(folderItem, 10); mp3File.TrackNumber = folder.GetDetailsOf(folderItem, 19); } folderItem = null; folder = null; shell = null; return mp3File;
I'm using XPpro SP2. Please Help, Rob Tomson -- There are 10 kinds of people. Those who understand binary and those who don't.