Catastrophic failure (Exception from HRESULT: 0x8000FFFF) creating a playlist with axwindowsMediaPlayer

痴心易碎 提交于 2019-12-01 21:33:58

问题


I am using the axwindowsMediaPlayer object to show videos in a winform. In particular I want to play a playlist.

Everything works fine on my pc (win7) and used to work fine also in another pc with winXP (the pc of the final user).

But something happened a couple of days ago: on the XP PC I started to receive the following expcetion

Unhandled Exception:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

System.Runtime.InteropServices.COMException

Stack Trace:
   at WMPLib.IWMPPlaylistCollection.newPlaylist(String bstrName)
   at BrinaS941.ScreenSaverVideo.ScreenSaver_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Here the code that rises the exception:

private void ScreenSaverVideo_Load(object sender, EventArgs e)
{
    WMPLib.IWMPPlaylist playlist = VideoPlayer.playlistCollection.newPlaylist("myplaylist");
    WMPLib.IWMPMedia media;
    VideoPlayer.uiMode = "none";
    VideoPlayer.settings.volume = 10;
    [....]

The exception started to be risen while the application was working and now keep on having the same behavior.

I tried to reinstall Windows Media Player (11) on the XP machine, but nothing changed.

UPDATE:

I tried to comment the part of code related to the playlist (and use the method "URL" to set the video a want to play) and everything works fine. I am really puzzled...

Any help would be really appreciated. Thanks


回答1:


I finally found the problem!

My fault was not to remove the playlist once used (with IWMPPlaylistCollection::remove method ). I realized that I had 2000 playlists ( myplaylist.wpl, myplaylist(1).wpl,..., myplaylist(1999).wpl) in my file system and probably there is a limit of 2000.

I don't know if it's a limit of the file system or of WMP.

Once deleted all the files everything started working again.

Thanks everyone for your help!



来源:https://stackoverflow.com/questions/25155357/catastrophic-failure-exception-from-hresult-0x8000ffff-creating-a-playlist-wi

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