获取歌曲目前效力于Windows媒体播放器 [英] Get Song Currently Playing In Windows Media Player

查看:144
本文介绍了获取歌曲目前效力于Windows媒体播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用C#我怎么能获得歌曲名称,艺术家等当前正在播放Windows Media Player中?像MSN Messenger的/谷歌通话应用程序做到这一点。谢谢

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

推荐答案

有关C#

我花了几个小时的努力得到它为我的程序工作。
我终于想通了。

I spent hours trying to get it to work for my program. Finally I figured it out.

这解决方案是假设你有任何的Windows媒体播放器的控制。在项目表格或创建通过代码的对象..

This solution is assuming you have either the windows media player control ON a form in your project or have created the object through code..


  1. 创建一个新的Windows Media Player宋对象,并将其指向一个文件

  2. 创建一个字符串来保存你的艺术家,然后拉离歌对象艺术家信息

  3. 创建一个字符串来保存你的标题,然后拉离歌对象艺术家信息。

  1. create a new Windows Media Player Song object and point it to a file
  2. create a string to hold your artist, then pull the artist info from the song object
  3. create a string to hold your title, then pull the artist info from the song object.

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


这是这么简单我拍了拍自己,当我说完,看到我想不出任何地方找到了答案,我已经提供了它未来的家伙。

it was so simple i slapped myself when i finished, and seeing as i couldnt find the answer anywhere, i have provided it for the next guy.

这篇关于获取歌曲目前效力于Windows媒体播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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