Ver Mensaje Individual
  #3  
Antiguo 27-08-2010
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
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 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  // 10 temas al azar
    begin
      ItemIndex:= Random(Count-1);
      sndPlaySound(PChar(Items[ItemIndex]),SND_NODEFAULT OR SND_LOOP);
    end;
    ItemIndex:= 0;
  end;
  btAleatorio.SetFocus;
end;
end.

Saludos.
Responder Con Cita