Hola Gaston.
Ya que lo pedís te hago un aporte... (no esperes demasiado...
)
Hay mucho para retocar, pero por ahí te dá alguna idea nueva.
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;
type
TForm1 = class(TForm)
FileListBox1: TFileListBox;
btReproducir: TButton;
btAleatorio: TButton;
procedure btReproducirClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure btAleatorioClick(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation {$R *.dfm}
uses MMSystem;
procedure TForm1.FormCreate(Sender: TObject);
begin
with FileListBox1 do
begin
Mask:= '*.WAV';
Directory:='C:\Windows\Media\';
ItemIndex:= 0;
end;
end;
procedure TForm1.btReproducirClick(Sender: TObject);
begin
with FileListBox1 do
sndPlaySound(PChar(Items[ItemIndex]),SND_NODEFAULT);
end;
procedure TForm1.btAleatorioClick(Sender: TObject);
var
i: Integer;
begin
FileListBox1.SetFocus;
Randomize;
with FileListBox1 do
begin
for i:= 1 to 10 do begin
ItemIndex:= Random(Count-1);
sndPlaySound(PChar(Items[ItemIndex]),SND_NODEFAULT OR SND_LOOP);
end;
ItemIndex:= 0;
end;
btAleatorio.SetFocus;
end;
end.
Saludos.