Get a song playing in Windows Media Player

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

+3
source share
2 answers

For C #

I spent hours trying to get it to work on my program. I finally figured it out.

This solution assumes that you either control the Windows media player in the form of your project, or you created the object through code.

  • create a new Song Media Player Player object and point it to a file
  • ,
  • , .

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

, , , , , , .

+3

Source: https://habr.com/ru/post/1712818/


All Articles