unit Vv1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, FileCtrl, StdCtrls, Buttons, ExtCtrls, MPlayer,prdi,
  MyRotate;

type
  TForm1 = class(TForm)
    Image1: TImage;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Timer1: TTimer;
    MediaPlayer1: TMediaPlayer;
    Bevel1: TBevel;
    BitBtn3: TBitBtn;
    DirectoryListBox1: TDirectoryListBox;
    BitBtn4: TBitBtn;
    Label1: TLabel;
    BitBtn6: TBitBtn;
    FileListBox1: TFileListBox;
    Button1: TButton;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure DirectoryListBox1Change(Sender: TObject);
    procedure FileListBox1DblClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure BitBtn6Click(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  st,go:Boolean;
  star:Integer;
implementation

{$R *.DFM}

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

procedure TForm1.FormCreate(Sender: TObject);
begin
     with mediaplayer1 do
     begin
     filename:='\autorun\multi.wav';
     open;
     end;
     st:=True;
     star:=0;
     go:=false;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
     if bitbtn2.caption='Music On' then
     begin
        mediaplayer1.stop;
        st:=False;
        bitbtn2.caption:='Music Off';
     End
     else
     begin
        mediaplayer1.play;
        st:=True;
        bitbtn2.caption:='Music On';
     End;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
     with mediaplayer1 do
     if tracklength[1]=Position then
     begin
     filename:='\autorun\v3.wav';
     open;
     play;
     end;
     if st then mediaplayer1.play
     else mediaplayer1.stop;
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
var
   f:Textfile;
   i:integer;
begin
     assignfile(f,'c:\temp.ben');
     rewrite(f);
     tag:=1;
     for i:=0 to filelistbox1.items.count-1 do
     writeln(f,filelistbox1.items[i]);
     closefile(f);
     priDial.show;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
     if tag=1 then
     Deletefile('c:\temp.ben');
end;

procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
     FileListBox1.Directory:=DirectoryListBox1.Directory;
end;

procedure TForm1.FileListBox1DblClick(Sender: TObject);
var
 I,L:Integer;
 s,S2:String;
 cmd:array[0..255] of char;
begin
     for I:=0 to FileListBox1.Items.count-1 do
     If FileListBox1.Selected[I] then
     Begin
          S:=fileListBox1.items[I];
          L:=Length(s);
          s2:=s[L-2]+s[L-1]+s[L];
          If (s2='bmp') or (s2='pcx') or (s2='gif') then
          begin
          caption:='You choosed '+s2+' file';
          StrPcopy(cmd,'\vpic\vpic '+directorylistbox1.directory+'\'+s);
          Winexec(cmd,SW_ShowMaximized)
          end
          else
          caption:='This is the invalid file';
     End;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
WinExec('Winfile',SW_ShowMaximized);
end;

procedure TForm1.BitBtn6Click(Sender: TObject);
begin
     chdir(directorylistbox1.directory);
     WinExec('\vpic\vpic',SW_ShowMaximized);
end;

procedure TForm1.BitBtn4Click(Sender: TObject);
begin
     winexec('\ployvie\polyview',SW_ShowMaximized);
end;

end.
