7
votes

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
(1) have you stepped through your code to see exactly the point of error? (2) have you checked that the 'screensavervideo' is compatible with XP? (3) have you tried a 'try-catch' caption?jbutler483
(1) No, because on my dev pc the error doesn't happen. But I am pretty sure the line that throws the exception is "WMPLib.IWMPPlaylist playlist = VideoPlayer.playlistCollection.newPlaylist("myplaylist");" becuse I tried to move the line "VideoPlayer.uiMode = "none";" before and it is executed correctly. (2) Yes, since it worked correctly since 2 days ago (3) I inserted the code inside a try-catch: so my application doesn't crash, but the video are never playedmuccix
have a look in EventViewer it might give you a reason thereColin Smith
Could the problem be linked to the fact that I am developing on a PC with Win7 and Media Player 12, while the application is running on Win XP with Media Player 11?muccix
@colinsmith In the EventViewer I can not see anything useful. From what I understand the "WMPLib.IWMPPlaylistCollection" is an object contained in "Interop.WMPLib.dll" or in "AxInterop.WMPLib.dll" that I distribute with the application. Is there any reference in the dll of the pc that could be corrupted?muccix

1 Answers

9
votes

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!