1

I'm testing Windows Media player component in C#. At runtime my project receives the error :

System.Runtime.InteropServices.COMException: 'Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))'

when I'm changing fullscreen property

The related code line:

axWindowsMediaPlayer1.fullScreen = true; 

What's the reason?

Peter Csala
  • 17,736
  • 16
  • 35
  • 75
  • 2
    The only thing catastrophic here is the quality of the error reporting, WMP does not win a lot of prizes There are two ways to use this COM component. As a child control embedded in a form, like you do now, wrapped by AxHost. Or as a way to automate the existing player program, as an "out of process" server, no AxHost wrapper required. Only the latter can be made full screen, the control must stay embedded in the form. Consider maximizing the form. – Hans Passant Jul 23 '18 at 17:25
  • @HansPassant Thanks for your elegant point. So you mean when embedded in a form,WMP control CAN'T be in fullscreen mode?! – Hamid Reza Ebrahimi Jul 24 '18 at 02:46

1 Answers1

1

Finally I myself solved the problem: the embedded WMP control CAN BE maximized IF it's playing,so the following code MUST be used:

        if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
            axWindowsMediaPlayer1.fullScreen = true;  

Now the catastrophic error has gone:)