17 April 2012

Membuat MP3 Player dengan Delphi 7

Create Simple Media Player with Delphi

Teman semua pasti sudah tidak asing lagi pastinya dengan Media Player. Right, media player tentunya sangat membantu atau boleh dikatakan teman kita saat mengerjakan tugas ataupun sedang santai di depan komputer. 
Pada kesempatan kali ini, penulis akan memberikan script program delphi membuat mp3 player walaupun masih dibilang sangat sederhana. Berikut script-nya : 

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, MPlayer, ExtCtrls;



type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Timer1: TTimer;
    OpenDialog1: TOpenDialog;
    MediaPlayer1: TMediaPlayer;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    ProgressBar1: TProgressBar;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
progressbar1.position:=0;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if progressbar1.max<>0 then
progressbar1.position:=mediaplayer1.position;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
edit1.Text:=opendialog1.FileName;
end;
progressbar1.max:=0;
mediaplayer1.close;
mediaplayer1.filename:=edit1.Text;
mediaplayer1.open;
progressbar1.max:=mediaplayer1.length;
edit1.text:=inttostr(progressbar1.position);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
showmessage('copyright@=azid=2012'+chr(13)+'mediaplayer');
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin

end;

end.

Sekian, semoga bisa bermanfaat buat aGan" semua. 
Wassalam...