0

I have a problem handling the end of file state of the axWindows Media Player and then open another frame in Visual C++

Here is my function :

private: System::Void axWindowsMediaPlayer1_PlayStateChange(System::Object^  sender, AxWMPLib::_WMPOCXEvents_PlayStateChangeEvent^  e) {

                 if (e->newState == 8) {
                     this->Hide();
                     MainForm^ frame = gcnew MainForm();
                     frame->ShowDialog();

                 }
    }

If I build the project, the media player render the movie, plays it and when it reaches the end of file it's called the Hide function but the frame didn't show up. I receive no error.

What should I do or what I'm doing wrong ?

Captain Obvlious
  • 19,754
  • 5
  • 44
  • 74
Antaka
  • 27
  • 2
  • 4
  • I made a trick and display a message "Press any key to continue" and use the method keydown – Antaka Dec 02 '14 at 07:50

1 Answers1

0

In this kind of situation you should try to catch an exception, and read its message - it's very helpful, and helps spare some time in the future.

try 
{
    ...
}
catch (System::Exception^ e)
{
    System::Console::WriteLine(e->Message);
}