2
I managed to make a Thread that plays the song, but only once. If I put a loop on it I have several errors, like the 1400.
It seems that the thread does not close when you close Form1, because the problem always comes when I try to close it.
I have only 2 Units. 1 is Form1 and the other is Tmusica thread.
I’ve tried Goto, While, Repeat, With. Nothing works, the song is called music.mp3. I use the Delphi XE8
. How do I resolve?
Call from the Tmusica Thread:
procedure TForm1.FormCreate(Sender: TObject);
var
Thread:TMusica;
begin
//Bloco de Códigos
Thread := TMusica.Create(False);
Thread.FreeOnTerminate := True;
Thread.Resume;
//Outros códigos...
end;
A Thread Tmusica:
procedure TMusica.Execute;
begin
Form1.MediaPlayer1.FileName: = 'music.mp3';
Form1.MediaPlayer1.Open;
Form1.MediaPlayer1.Play;
end;
Put there a piece of code that plays the music! To help you we need to see what the code, not to be kicking and kicking!
– Junior Moreira
Follow my project. It’s super small, thank you for helping. http://www.mediafire.com/download/d6dqwba74ijodxx/Projects.zip
– Adriano rox
@Victordm put the relevant code to the question instead of putting a link. That way it becomes easier to help you. In this case I would say to put the relevant code to thread of sound
– Omni