Amigos ayuda porfa
hice un reproductor de Audio y video, en Delphi 7, que objeto de solapa o ficha utilizo?
q evento activo o donde inserto el codigo q ahan enviado algunos
Gracias.
les dejo mi codigo:
*****************************************
al insertar el codigo q han enviado no me da errores, q onda?
*****************************************
Código Delphi
[-]
var
F_mp3: TF_mp3;
implementation
uses Unit2, MMSystem;
type
TVolumeRec = record
case Integer of
0: (LongVolume: Longint) ;
1: (LeftVolume, RightVolume : Word) ;
end;
const DeviceIndex=5
;
procedure SetVolume(aVolume:Byte) ;
var Vol: TVolumeRec;
begin
Vol.LeftVolume := aVolume shl 8;
Vol.RightVolume:= Vol.LeftVolume;
auxSetVolume(UINT(DeviceIndex), Vol.LongVolume) ;
end;
function GetVolume:Cardinal;
var Vol: TVolumeRec;
begin
AuxGetVolume(UINT(DeviceIndex),@Vol.LongVolume) ;
Result:=(Vol.LeftVolume + Vol.RightVolume) shr 9;
end;
{$R *.dfm}
procedure TF_mp3.ToolButton3Click(Sender: TObject);
begin
Pagecontrol1.ActivePageIndex := 0;
end;
procedure TF_mp3.ToolButton5Click(Sender: TObject);
begin
PageControl1.ActivePageIndex := 1;
end;
procedure TF_mp3.ToolButton1Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TF_mp3.BitBtn1Click(Sender: TObject);
begin
if Opendialog1.Execute = true Then
MediaPlayer1.FileName := Opendialog1.FileName;
MediaPlayer1.Open;
MediaPlayer1.DisplayRect :=rect(0,0,OleContainer1.Width,OleContainer1.Height);
MEdiaPlayer1.Play;
StatusBar1.SimpleText := 'Repoduciendo Archivo: ' + OpenDialog1.FileName;
Label3.Visible := True;
Label4.Visible := True;
end;
procedure TF_mp3.Timer1Timer(Sender: TObject);
var
posicion, duracion : LongInt;
begin
if StatusBar1.SimpleText <> 'Inactivo' then
begin
with MediaPlayer1 do
begin
MediaPlayer1.TimeFormat := tfMilliseconds;
duracion := Round(Length div 1000);
scrollBar1.Max := length;
Label3.Caption := Format('%d:%d',[duracion div 60, duracion Mod 60]);
posicion := round(Position div 1000);
Label4.Caption := Format('%d:%d',[posicion div 60, posicion Mod 60]);
ScrollBar1.Position := position; end;
end;
end;
procedure TF_mp3.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (HiWord(GetKeyState(VK_MENU)) <> 0) and (Key = 13) then
begin
if F_mp3.WindowState = WsNormal then
begin
Width := F_mp3.Width;
Height:= F_mp3.Height;
Label1.Visible := False;
Label2.Visible := False;
Label3.Visible := False;
Label4.Visible := False;
MediaPlayer1.Visible := False;
BitBtn1.Visible := False;
StatusBar1.Visible := False;
ScrollBar1.Visible := False;
OleContainer1.Visible := False;
F_mp3.BorderStyle := BsNone;
F_mp3.WindowState := WsMaximized;
MediaPlayer1.Display := F_mp3;
MediaPlayer1.DisplayRect := rect(0,0,F_mp3.Clientwidth,F_mp3.ClientHeight);
end
else
begin
F_mp3.WindowState := WsNormal;
F_mp3.Width := Width;
F_mp3.Height := Height;
F_mp3.Position := PoScreenCenter;
Label1.Visible := True;
Label2.Visible := True;
Label3.Visible := True;
Label4.Visible := True;
MediaPlayer1.Visible := True;
BitBtn1.Visible := True;
StatusBar1.Visible := True;
ScrollBar1.Visible := True;
OleContainer1.Visible := True;
F_mp3.BorderStyle := BsSingle;
MediaPlayer1.Display := OleContainer1;
MediaPlayer1.DisplayRect := rect(0,0,F_mp3.Clientwidth,F_mp3.ClientHeight);
end;
end;
end;
procedure TF_mp3.FormPaint(Sender: TObject);
var
i: Integer;
procedure MakeShadow(control: TControl; Width: Integer; Color: TColor);
var
rect: TRect;
old: TColor;
begin
rect := control.boundsrect;
rect.Left := rect.Left + width;
rect.Top := rect.Top + width;
rect.Right := rect.Right + width;
rect.Bottom := rect.Bottom + width;
old := Self.canvas.brush.color;
Self.canvas.brush.Color := color;
Self.canvas.fillrect(rect);
Self.canvas.brush.Color := old;
end;
begin
for i:=0 to Self.ControlCount-1 do
if self.Controls[i].Visible then
MakeShadow(Self.Controls[i],2,clGray);
end;
procedure TF_mp3.BitBtn2Click(Sender: TObject);
begin
Form2.ShowModal;
end;
end.