Guys
That application to play mp3 that I transferred to C++ Winforms, changed by mistake. Now it's giving the error object reference not set to an instance of an object saying that the WindowsMediaPlayer type variable is null. At the beginning of the program I put the line:
WindowsMediaPlayer^ musica;
When I order the music to play in the program section below, it gives the error.
if (musica->playState == WMPPlayState::wmppsUndefined || musica->playState == WMPPlayState::wmppsStopped)
{
musica->URL = arquivoMP3;
musica->controls->play(); // toca a m[usica
// TROCA A IMAGEM DE PLAY PARA PAUSA
btnPlay->ImageIndex = 1;
timer1->Enabled = true;
}
else
if (musica->playState == WMPPlayState::wmppsPlaying) // SE MUSICA ESTÁ TOCANDO
{
musica->controls->pause(); // SE CLICAR NO PLAY QDO A MUSICA TIVER TOCANDO, PAUSA A MUSICA
btnPlay->ImageIndex = 0; // MUDA A IMAGEM PARA PLAY
}
else
if (musica->playState == WMPPlayState::wmppsPaused) // SE A MÚSICA ESTÁ PAUSADA
{
musica->controls->play(); // SE CLICAR NA PAUSA A MUSICA COMEÇA A TOCAR
btnPlay->ImageIndex = 1; // MUDA A IMAGEM DE PLAY PARA PAUSA
}
}
Here it already says that musica is null. How to create an instance of the music variable?
Tanks