[Delphi] DH Player 0.1

Iniciado por BigBear, 13 Mayo 2013, 23:40 PM

0 Miembros y 1 Visitante están viendo este tema.

BigBear

Un simple reproductor de musica que hice basado en este articulo.

Una imagen :



El codigo :

Código (delphi) [Seleccionar]

// DH Player 0.1
// Coded By Doddy H
// Based on this article : http://delphi.about.com/od/multimedia/l/aa112800a.htm

unit mp3player;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, StdCtrls, sListBox, sSkinManager, MPlayer, sGroupBox, jpeg,
  ExtCtrls, ComCtrls, acProgressBar, Buttons, FileCtrl, sEdit;

type
  TForm1 = class(TForm)
    sSkinManager1: TsSkinManager;
    sGroupBox1: TsGroupBox;
    sListBox1: TsListBox;
    sGroupBox2: TsGroupBox;
    MediaPlayer1: TMediaPlayer;
    Image1: TImage;
    sGroupBox3: TsGroupBox;
    sProgressBar1: TsProgressBar;
    PopupMenu1: TPopupMenu;
    L1: TMenuItem;
    R1: TMenuItem;
    A1: TMenuItem;
    E1: TMenuItem;
    Directory: TsGroupBox;
    sEdit1: TsEdit;
    Timer1: TTimer;
    procedure A1Click(Sender: TObject);
    procedure E1Click(Sender: TObject);
    procedure R1Click(Sender: TObject);
    procedure L1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure sListBox1DblClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.A1Click(Sender: TObject);
begin
  ShowMessage('Contact to lepuke[at]hotmail[com]');
end;

procedure TForm1.E1Click(Sender: TObject);
begin
  Form1.Close();
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  sProgressBar1.Max := 0;
  sSkinManager1.SkinDirectory := ExtractFilePath(Application.ExeName) + 'Data';
  sSkinManager1.SkinName := 'fm';
  sSkinManager1.Active := True;
end;

procedure TForm1.L1Click(Sender: TObject);
var
  dir: string;
  search: TSearchRec;
  cantidad: Integer;

begin

  SelectDirectory('Select a folder', '', dir);

  sListBox1.Clear;

  sEdit1.Text := dir;
  cantidad := FindFirst(dir + '/' + '*.*', faAnyFile, search);

  while cantidad = 0 do
  begin
    if FileExists(dir + '/' + search.name) then
    begin
      sListBox1.Items.Add(search.name);
    end;
    cantidad := FindNext(search);
  end;
  FindClose(search);

end;

procedure TForm1.R1Click(Sender: TObject);
begin
  sEdit1.Text := '';
  sProgressBar1.Max := 0;
  sListBox1.Clear;
end;

procedure TForm1.sListBox1DblClick(Sender: TObject);
begin

  sProgressBar1.Max := 0;

  MediaPlayer1.Close;
  MediaPlayer1.FileName := sEdit1.Text + '/' + sListBox1.Items.Strings
    [sListBox1.ItemIndex];
  MediaPlayer1.Open;

  sProgressBar1.Max := MediaPlayer1.Length;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if sProgressBar1.Max <> 0 then
    sProgressBar1.Position := MediaPlayer1.Position;
end;

end.

// The End ?


Si lo quieren bajar lo pueden hacer de aca