0
我剛剛發現了C#的Windows媒體播放器庫,因爲我爲我的朋友製作了一個愚蠢的小應用程序,我以爲我會添加它(因爲他喜歡音樂) 。C#中的WMP庫 - 列表中的播放列表
string ply = "Playlist";
WMPLib.IWMPPlaylist pls;
WMPLib.IWMPPlaylistArray plItems;
plItems = axWindowsMediaPlayer1.playlistCollection.getByName(ply);
if (plItems.count == 0)
{
pls = axWindowsMediaPlayer1.playlistCollection.newPlaylist(ply);
}
else
{
plItems.Item(0);
string line;
System.IO.StreamReader stream = new StreamReader(pth);
while ((line = stream.ReadLine()) != null)
{
if (File.Exists(line))
{
WMPLib.IWMPMedia m1 = axWindowsMediaPlayer1.newMedia(line);
pls.appendItem(m1); /*gives an error here (use of unassigned variable)*/
}
}
}
}
我試圖創建播放列表的一個實例,但我不能得到它,讓這條線,任何幫助,將不勝感激 (請注意,「PTH」字符串的聲明早些時候方法