How to interact with Windows Media Player in C#

后端 未结 4 1275
悲哀的现实
悲哀的现实 2020-11-29 23:45

I am looking for a way to interact with a standalone full version of Windows Media Player.
Mostly I need to know the Path of the currently played track.

The iTun

4条回答
  •  广开言路
    2020-11-29 23:53

    Just add a reference to wmp.dll (\windows\system32\wmp.dll)

    using WMPLib;
    

    And then you can instantiate a media player

    var Player = new WindowsMediaPlayer();
    // Load a playlist or file and then get the title 
    var title = Player.controls.currentItem.name;
    

    See Creating the Windows Media Player Control Programmatically for more information

提交回复
热议问题