axWindowsMediaPlayer Visual C++ End of File

309 views Asked by At

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 ?

1

There are 1 answers

0
Mateusz Guzdek On BEST ANSWER

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);
}