我正在使用 axwindowsMediaPlayer 对象在 winform 中显示视频。特别是我想播放一个播放列表。
在我的电脑 (win7) 上一切正常,过去在另一台装有 winXP 的电脑(最终用户的电脑)上也能正常工作。
但是几天前发生了一些事情:在 XP PC 上我开始收到以下异常
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)
这里是引发异常的代码:
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;
[....]
异常在应用程序运行时开始出现,现在继续具有相同的行为。
我尝试在 XP 机器上重新安装 Windows Media Player (11),但没有任何改变。
更新:
我试图评论与播放列表相关的代码部分(并使用方法“URL”来设置要播放的视频)并且一切正常。我真的很纳闷……
任何帮助将不胜感激。 谢谢
最佳答案
终于找到问题了!
我的错误是没有在使用后删除播放列表(使用 IWMPPlaylistCollection::remove 方法 ).我意识到我的文件系统中有 2000 个播放列表(myplaylist.wpl、myplaylist(1).wpl、...、myplaylist(1999).wpl),可能有 2000 个的限制。
不知道是文件系统的限制还是WMP的限制。
一旦删除了所有文件,一切都会重新开始。
感谢大家的帮助!
关于c# - 灾难性故障(HRESULT : 0x8000FFFF) creating a playlist with axwindowsMediaPlayer 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25155357/