如何在C#与Windows Media Player进行交互 [英] How to interact with Windows Media Player in C#

查看:571
本文介绍了如何在C#与Windows Media Player进行交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一种方式来与Windows Media Player的一个独立的完整版本的交互。

主要是我需要知道当前播放的曲目的路径。

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.

iTunes的SDK使这很容易可惜实在是没有任何办法与Windows Media Player做到这一点,至少不会在.net(C#)没有任何大量使用PInvoke的,这我不是很舒服

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.

感谢

只是为了clearify:我不想在我的应用程序的Windows Media Player嵌入一个新实例,而是控制/读真正的完整版本的Windows Media Player,seperatly开始由用户

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

推荐答案

我有这个的http://forums.msdn.microsoft.com/en-US/clr/thread/dbd43d7e-f3a6-4087-be06-df17e76b635d在我的书签但无论如何也不能对其进行了测试。在正确的方向只是一个指针。这没有什么官方的和需要挖掘一下,但你应该得到一个相当简单的包装(这将仍然使用的PInvoke引擎盖下 - 但你不会看到它)。围绕Windows媒体播放器

I had this http://forums.msdn.microsoft.com/en-US/clr/thread/dbd43d7e-f3a6-4087-be06-df17e76b635d 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.

希望有所帮助。

呵呵,我误解了。我还以为你在谈论控制当前正在运行的Windows Media Player实例。如果您承载Windows Media Player的自己,那么WMPLib肯定是更好的解决方案。

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.

这篇关于如何在C#与Windows Media Player进行交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆