hier bissl source der dein problem lösen sollte
Delphi-Quellcode:
TSoundThread = class(TThread)
protected
procedure Execute; override;
end;
TForm1 = class(TForm)
[...]
private
procedure fThreadvorbei(Sender: TObject);
[...]
end;
[...]
procedure TSoundThread.Execute;
begin
sndPlaySound('c:\windows\media\ringout.wav', snd_sync or snd_NoDefault)
end;
procedure TForm1.fThreadvorbei(Sender: TObject);
begin
stop:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
var Lthread: TSoundThread;
begin
Lthread := TSoundThread.Create(False);
LThread.OnTerminate := fThreadvorbei;
LThread.Resume;
stop := false;
end;