namespace WMPDemo
{
public partial class Form2 : Form
{ //MediaPlayer有个currentPlaylist属性,应该可以从这里下手
//创建一个音乐对象的LIST来存放 对这个List进行操作
//播放的时候用wmpPlayer.currentMedia.sourceURL获取List中具体的音乐
//我刚刚写完这个 可以一起讨论讨论
static WMPLib.WindowsMediaPlayerClass wmpPlayer = new WMPLib.WindowsMediaPlayerClass();
public Form2()
{
InitializeComponent();
}
static Form2()
{
wmpPlayer.StatusChange+=new WMPLib._WMPOCXEvents_StatusChangeEventHandler(wmpPlayer_StatusChange);
}
static void wmpPlayer_StatusChange()
{
if(wmpPlayer.playState == WMPLib.WMPPlayState.wmppsStopped)
{
wmpPlayer.controls.play();
}
}
private void button1_Click(object sender, EventArgs e)
{
wmpPlayer.controls.play();
wmpPlayer.controls.previous();
wmpPlayer.controls.next();
wmpPlayer.currentPlaylist = new PlayList();
}
}
}
using WMPLib;
namespace WMPDemo
{
public class PlayList : IWMPPlaylist
{
public void appendItem(IWMPMedia pIWMPMedia)
{
throw new NotImplementedException();
}
public int attributeCount
{
get { throw new NotImplementedException(); }
}
public void clear()
{
throw new NotImplementedException();
}
public int count
{
get { throw new NotImplementedException(); }
}
public string getItemInfo(string bstrName)
{
throw new NotImplementedException();
}
public IWMPMedia get_Item(int lIndex)
{
throw new NotImplementedException();
}
public string get_attributeName(int lIndex)
{
throw new NotImplementedException();
}
public bool get_isIdentical(IWMPPlaylist pIWMPPlaylist)
{
throw new NotImplementedException();
}
public void insertItem(int lIndex, IWMPMedia pIWMPMedia)
{
throw new NotImplementedException();
}
public void moveItem(int lIndexOld, int lIndexNew)
{
throw new NotImplementedException();
}
public string name
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public void removeItem(IWMPMedia pIWMPMedia)
{
throw new NotImplementedException();
}
public void setItemInfo(string bstrName, string bstrValue)
{
throw new NotImplementedException();
}
}
}