How to delete a windows media playlist programmatically

折月煮酒 提交于 2020-02-06 04:36:07

问题


I am using a C# application where I have to create a playlist. At the end of this application on form close I want to delete this play list which has been created. How do I do this?

what I want is WMP.playlistCollection.remove("myplaylist");

This is wrong and does not work. Is there something similar?


回答1:


you need to give Playlist object as the parameter

IWMPPlaylistArray plCollection = WMP.playlistCollection.getByName("myplaylist");
if (plCollection.count > 0)
{
    IWMPPlaylist pl = plCollection.Item(0);
    WMP.playlistCollection.remove(pl);
}



回答2:


WMP.playlistCollection.remove()

removes the playlist from windows media player, but the file are still present in the file system int the My Documents/MyMusic/My Playlists folder.

As stated here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd564786(v=vs.85).aspx

"Remarks

This method deletes an item from the library. This method does not delete files from the user's computer."



来源:https://stackoverflow.com/questions/18895574/how-to-delete-a-windows-media-playlist-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!