Hola, epero te sirva de algo
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, MPlayer;
type
TForm2 = class(TForm)
GroupBox1: TGroupBox;
ListBox1: TListBox;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
OpenDialog1: TOpenDialog;
ListBox2: TListBox;
MediaPlayer1: TMediaPlayer;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure ListBox1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
nombre:string;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
form2.Width :=240;
listbox1.MultiSelect := true;
end;
procedure TForm2.SpeedButton1Click(Sender: TObject);
var
i,largo,j,minu, seg:integer;
aux,largot,min:string;
begin
if opendialog1.Execute then
begin
largo:=length(opendialog1.FileName );
j:=0;
for i:=largo-4 downto 1 do
begin
j:=j+1;
aux:=copy(opendialog1.FileName ,i,1);
if aux='\' then
begin
break;
end;
nombre:= copy(opendialog1.FileName ,i,j);
end;
listbox2.Items.Add (opendialog1.FileName) ;
mediaplayer1.FileName := opendialog1.FileName ;
mediaplayer1.Open ;
largot:=inttostr(mediaplayer1.TrackLength [1]);
for i:=1 to 3 do
begin
min:=min+copy(largot,i,1);
end;
minu:= strtoint(min) div 60;
seg:= strtoint(min) mod 60;
edit1.Text := inttostr(minu) + ':' + inttostr(seg);
listbox1.Items.Add(nombre + ' ' + edit1.Text);
end;
mediaplayer1.Close ;
end;
procedure TForm2.SpeedButton2Click(Sender: TObject);
begin
listbox1.DeleteSelected;
end;
procedure TForm2.SpeedButton3Click(Sender: TObject);
begin
//listbox1.
end;
procedure TForm2.ListBox1DblClick(Sender: TObject);
begin
form1.Edit1.Text :=listbox1.Items.Strings [listbox1.ItemIndex ];
form1.MediaPlayer1.FileName :=
listbox2.Items.Strings [listbox1.ItemIndex ];
form1.MediaPlayer1.Open ;
form1.mediaplayer1.Play ;
end;
end.