unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, MPlayer, ExtCtrls,Unit2, Mmsystem, ComCtrls, StdCtrls;
type
HMSRec=record
Hours: byte;
Minutes: byte;
Seconds: byte;
Notused: byte;
end;
TForm1 = class(TForm)
Panel1: TPanel;
MediaPlayer1: TMediaPlayer;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
TrackBar1: TTrackBar;
OpenDialog1: TOpenDialog;
MainMenu1: TMainMenu;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
Label1: TLabel;
Timer1: TTimer;
procedure N1Click(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
CanTimerAutoChange:Boolean;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.N1Click(Sender: TObject);
begin
Form2.BorderStyle:=bsNone;
form2.WindowState:=wsMaximized;
MediaPlayer1.Display:=form2;
MediaPlayer1.DisplayRect:=Rect(0,0,Form2.Width,Form2.Height);
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
var t,v:longint;
begin
t:=TrackBar1.position;
v:=(t shl 8) or (t shl 24);
WaveOutSetvolume(0,v);
end;
procedure TForm1.N4Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
MediaPlayer1.FileName:= OpenDialog1.FileName;
MediaPlayer1.Open;
MediaPlayer1.Notify:=true;
end;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
MediaPlayer1.DisplayRect:=Panel1.ClientRect;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var TheLength:LongInt;
begin
if MediaPlayer1.FileName<>'' then
CanTimerAutoChange:=True;
TheLength:=MediaPlayer1.Length;
with HMSRec(TheLength)do
begin
Label1.Caption:=IntTostr(Minutes)+':'+IntTostr(Seconds);
end;
end;
end.