At this late date, you don't need us to tell you that the MP3 file format is big. Chances are, at one point, you even considered coding your own Visual Basic MP3 player. If cost isn't a factor, a multitude of available options exist to do so. Several companies like Dialog-Medien provide ActiveX controls that play MP3 files. As an alternative, you could also write a program that remotely controls another application like the popular WinAmp MP3 player. However, if you have an up-to-date version of Windows Media Player, you already have a freely available solution.
Even given the relatively easy programming interface provided by Windows Media Player, deciphering information included in an MP3--such as the song title and artist's name--can take a little extra work. In this article, we'll not only show you how to use the Windows Media Player to build an MP3 player like the one displayed in Figure A, but we'll also show you how to decode important MP3 tag information.
Figure A: The Windows Media Player provides Visual Basic programmers with free, easy access to MP3 files.
What you'll need
In order to use Media Player to play MP3 files in Visual Basic, you'll need version 5.2 or later (the Microsoft Web site www.microsoft.com/windows/windowsmedia/en/download/default.asp contains version 6.4 and 7.0). You add the Media Player OCX to a project just like any ordinary OCX component.