我正在使用 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的限制。
删除所有文件后,一切都重新开始工作。
感谢大家的帮助!
我遇到了一个熟悉的情况,先生,我该如何解决这些问题!以及如何清除播放列表?