Ver Mensaje Individual
  #2  
Antiguo 19-03-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Jusar.

Podés utilizar el componente TMediaPlayer.

Por ejemplo:
Código:
...
#include<mplayer.hpp>
#define MP3_FILE "C:\\Users\\User\\Music\\Sound.mp3" /* ruta+nombre_archivo */

TMediaPlayer *mp = new TMediaPlayer(Form1);

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  mp->Parent = this;
  mp->Visible = false;
  mp->FileName = MP3_FILE;
  mp->AutoRewind = true;
  mp->AutoOpen = true;
  mp->OnNotify = MediaPlayerNotify;
  mp->Open();
  mp->Play();
}

void __fastcall TForm1::MediaPlayerNotify(TObject *Sender)
{
  if (mp->NotifyValue == nvSuccessful ){
   mp->Play();
   mp->Notify = true;
  }
}

void __fastcall TForm1::FormDestroy(TObject *Sender)
{
  mp->Close();
  delete mp;
}
También y más simple aún, pones el componente desde la paleta System y ajustas sus propiedades desde el Object Inspector.
Código:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
 MediaPlayer1->Open();
 MediaPlayer1->Play();
}

void __fastcall TForm1::MediaPlayer1Notify(TObject *Sender)
{
 if (MediaPlayer1->NotifyValue == nvSuccessful ){
   MediaPlayer1->Play();
   MediaPlayer1->Notify = true;
  }
}

Un saludo.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 19-03-2012 a las 22:45:58.
Responder Con Cita