Catastrophic failure (Exception from HRESULT: 0x80

2020-04-07 18:45发布

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条回答
地球回转人心会变
2楼-- · 2020-04-07 19:21

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!

查看更多
登录 后发表回答