如何在 C# 中控制 Windows Media Player 的实例?
我正在尝试用 C# 控制 Windows Media Player。这意味着,我希望能够以编程方式播放歌曲。重申一下,我谈论的是 WMP 的完整版本,而不是可以嵌入到 Windows 窗体中的组件。我可以很好地启动 WMP 进程,问题在于实际控制它,因为我想不出可以发送给播放器的任何按键来告诉它选择歌曲并播放音乐。我可以在 iTunes 中通过向进程发送空格键来完成此操作,但在 Windows Media Player 中则不然。有人对如何用 C# 以编程方式控制寡妇媒体播放器有任何想法吗?我可以向进程发送特殊命令来完成此任务吗?
I'm trying to control windows media player in c#. That means, I want to be able to programmically play songs. To reiterate, I'm talking about the full version of WMP, not the component you can embed into a windows form. I can launch the WMP process just fine, the problem comes in actually controlling it as I can't think of any keypresses I can send to the player that would tell it to select a song and play music. I can do this in iTunes just fine by sending a spacebar key-press to the process, but not so in Windows Media Player. Does anyone have any ideas as per how I can control widows media player programmically in C#? Is there a special command I can send to the process to complete this task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里是如何使用 p/invoke 与 WMP 交互的链接.. 。
这是一个与已经提出的问题几乎相同的问题 已在 Stack Overflow 中得到解答。
Here is a link do how to interact with WMP using p/invoke...
This is a question that's almost identical to this one that has already been answered in Stack Overflow.