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

<p>The iTunes SDK makes this really easy but unfortunately there really isn't any way to do it with Windows Media Player, at least not in .Net(C#) without any heavy use of pinvoke, which I am not really comfortable with.</p>

<p>Thanks</p>

<p>Just to clearify: I don't want to embedded a new instance of Windows Media Player in my app, but instead control/read the "real" full version of Windows Media Player, started seperatly by the user</p>

[{'answer_id': 56493, 'author': 'Alex Duggleby', 'author_id': 5790, 'author_profile': 'https://Stackoverflow.com/users/5790', 'pm_score': 3, 'selected': True, 'text': '<p>I had this <a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/dbd43d7e-f3a6-4087-be06-df17e76b635d/windows-media-player-remoting-in-c?forum=clr" rel="nofollow noreferrer">https://social.msdn.microsoft.com/Forums/vstudio/en-US/dbd43d7e-f3a6-4087-be06-df17e76b635d/windows-media-player-remoting-in-c?forum=clr</a> in my bookmarks but have NOT tested it in anyway. Just a pointer in the right direction. It\'s nothing official and will require a bit of digging, but you should get a fairly simple wrapper (which will still use PInvoke under the hood - but you won\'t see it) around Windows Media Player.</p>\n\n<p>Hope that helps.</p>\n\n<p>Oh, I misunderstood. I thought you were talking about controlling the currently running Windows Media Player instance. If you are hosting Windows Media Player yourself then WMPLib is certainly the better solution.</p>\n'}, {'answer_id': 56494, 'author': 'Markus Olsson', 'author_id': 2114, 'author_profile': 'https://Stackoverflow.com/users/2114', 'pm_score': 3, 'selected': False, 'text': '<p>Just add a reference to wmp.dll (\\windows\\system32\\wmp.dll)</p>\n\n<pre><code>using WMPLib;\n</code></pre>\n\n<p>And then you can instantiate a media player</p>\n\n<pre><code>var Player = new WindowsMediaPlayer();\n// Load a playlist or file and then get the title \nvar title = Player.controls.currentItem.name;\n</code></pre>\n\n<p>See <a href="http://msdn.microsoft.com/en-us/library/bb262248(VS.85).aspx" rel="noreferrer">Creating the Windows Media Player Control Programmatically</a> for more information</p>\n'}, {'answer_id': 56504, 'author': 'Dave Arkell', 'author_id': 4002, 'author_profile': 'https://Stackoverflow.com/users/4002', 'pm_score': 1, 'selected': False, 'text': '<p>The best info I have seen on interacting with Windows Media Player is this <a href="http://blogs.msdn.com/toub/archive/2007/09/22/fun-with-dvr-ms.aspx" rel="nofollow noreferrer">article</a> written by Stephen Toub.</p>\n\n<p>He lists a whole load of different ways to play dvr-ms files (doesn\'t really matter what format they are for this though).  The bit that is possibly of interest to you is about using a Media Player ActiveX Control, which you can add to the visual Studio toolbox by right-clicking and adding the Windows Media Player ActiveX COM Control.  You can then embed the player into your app, and access various properties of Media Player, like the url:</p>\n\n<pre><code>WMPplayer.URL = stringPathToFile;\n</code></pre>\n\n<p>This solution is possibly not what you want because it\'s starting a new instance of Media Player (as far as I know), however it might point you in the right direction.</p>\n'}, {'answer_id': 764856, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>For remoting the Windows Media Player, you can use the IWMPRemoteMediaServices interface to control the stand alone Windows Media Player. And you should be able to read all the informations you want like title or filename from your WMP player object. Unfortunately there is no C# smaple code in the SDK included. You can get the files from here: <a href="http://d.hatena.ne.jp/punidama/20080227" rel="noreferrer">http://d.hatena.ne.jp/punidama/20080227</a> Look for the file WmpRemote.zip\nOriginally it\'s from here: <a href="http://blogs.msdn.com/ericgu/archive/2005/06/22/431783.aspx" rel="noreferrer">http://blogs.msdn.com/ericgu/archive/2005/06/22/431783.aspx</a></p>\n\n<p>Then you have to cast to the WindowsMediaPlayer object:\nRemotedWindowsMediaPlayer rm = new RemotedWindowsMediaPlayer();\nWMPLib.WindowsMediaPlayer myPlayer = this.GetOcx() as WMPLib.WindowsMediaPlayer;</p>\n\n<p>and there you go..</p>\n'}]
['https://Stackoverflow.com/questions/56478', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5798/']