views:

574

answers:

2

Hi, Using C# how can I get the name of the song, artists etc that is currently playing in Windows Media Player? Applications like MSN Messenger / Google Talk do this. Thanks

+2  A: 

You need to use Wmp.dll.

This link will also be helpful:

http://msdn.microsoft.com/en-us/library/dd563844(VS.85).aspx

waqasahmed
+1  A: 

For C#

I spent hours trying to get it to work for my program. Finally I figured it out.

This solution is assuming you have either the windows media player control ON a form in your project or have created the object through code..

  1. create a new Windows Media Player Song object and point it to a file
  2. create a string to hold your artist, then pull the artist info from the song object
  3. create a string to hold your title, then pull the artist info from the song object.

            WMPLib.IWMPMedia song = wmp.newMedia(@"C:\SongName.mp3");         
            string tmpArtist = song.getItemInfo("Artist");
            string tmpTitle = song.getItemInfo("Title");
    

it was so simple i slapped myself when i finished, and seeing as i couldnt find the answer anywhere, i have provided it for the next guy.

StonerSmurf