Ver Mensaje Individual
  #2  
Antiguo 16-07-2007
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
Prueba con algo así:
Código Delphi [-]
type
  TSound = class(TThread)
  private
    FPath: String;
  protected
    procedure Execute; override;
  public
    constructor Create(Path: String);
  end;

uses mmsystem;

{ TSound }

constructor TSound.Create(Path: String);
begin
  FPath:= Path;
  FreeOnTerminate:= TRUE;
  inherited Create(FALSE);
end;

procedure TSound.Execute;
begin
  while not Terminated do
  begin
    if FPath <> '' then
      PlaySound(PChar(FPath),0,SND_FILENAME or SND_SYNC)
    else
      // Pausa entre sonidos, usa la que prefieras
      Sleep(10);
  end;
end;

Y para usarlo:
Código Delphi [-]
  with TSound.Create('C:\WINDOWS\Media\Chord.wav') do
  begin
    ShowMessage('Pulsa aceptar para terminar');
    Terminate;
  end;
Responder Con Cita