|
@@ -0,0 +1,97 @@
|
|
|
+{$J+}
|
|
|
+{
|
|
|
+OSInet media autorunner
|
|
|
+Copyright 2005 Ouest Systèmes Informatiques
|
|
|
+
|
|
|
+2005-08-13 Initial version created for a McAfee CD for BICA
|
|
|
+2007-10-08 Updated for a Zend DVD for ACSSA
|
|
|
+
|
|
|
+$Id: ufmMain.pas,v 1.1 2007-10-08 19:59:13 marand Exp $
|
|
|
+}
|
|
|
+unit ufmMain;
|
|
|
+
|
|
|
+interface
|
|
|
+
|
|
|
+uses
|
|
|
+ Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
+ Dialogs, StdCtrls, ExtCtrls, IniFiles, ShellAPI;
|
|
|
+
|
|
|
+type
|
|
|
+ TfmOAR = class(TForm)
|
|
|
+ M: TMemo;
|
|
|
+ tm: TTimer;
|
|
|
+ procedure FormCreate(Sender: TObject);
|
|
|
+ procedure tmTimer(Sender: TObject);
|
|
|
+ private
|
|
|
+ { Déclarations privées }
|
|
|
+ procedure ApplicationActivate (Sender : TObject) ;
|
|
|
+ public
|
|
|
+ { Déclarations publiques }
|
|
|
+ end;
|
|
|
+
|
|
|
+var
|
|
|
+ fmOAR: TfmOAR;
|
|
|
+
|
|
|
+implementation
|
|
|
+
|
|
|
+{$R *.dfm}
|
|
|
+
|
|
|
+procedure TfmOAR.ApplicationActivate (Sender : TObject) ;
|
|
|
+
|
|
|
+ const
|
|
|
+ csIniFile = 'autorun.inf' ;
|
|
|
+ csSection = 'autorun' ;
|
|
|
+ csVerb = 'index' ;
|
|
|
+
|
|
|
+ isLoaded : Boolean = False ;
|
|
|
+
|
|
|
+ var ini : TIniFile ;
|
|
|
+ sl : TStringList ;
|
|
|
+ cmd : String ;
|
|
|
+ ret : Cardinal ;
|
|
|
+ msg : String ;
|
|
|
+
|
|
|
+ begin
|
|
|
+ if isLoaded then
|
|
|
+ exit ;
|
|
|
+
|
|
|
+ isLoaded := True ;
|
|
|
+ ini := TIniFile.Create(GetCurrentDir + '\' + csIniFile) ;
|
|
|
+ sl := TStringList.Create ;
|
|
|
+ ini.ReadSectionValues(csSection, sl);
|
|
|
+// ShowMessage('il y a ' + IntToStr(sl.count) + ' chaines');
|
|
|
+ cmd := sl.Values [csVerb] ;
|
|
|
+ if cmd = '' then
|
|
|
+ ShowMessage ('Pas de clause ' + csVerb + ' dans la section '
|
|
|
+ + csSection + ' de ' + csIniFile + '. Rien à charger.')
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ msg := 'Chargement de: ' + cmd ;
|
|
|
+ ret := ShellExecute (Application.Handle, 'open', PAnsiChar (cmd), nil, nil, SW_SHOWMAXIMIZED) ;
|
|
|
+ if ret < 32 then
|
|
|
+ begin
|
|
|
+ msg := msg + ('--> Erreur ' + InttoStr (ret)) ;
|
|
|
+ tm.Interval := 10000 ;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ msg := msg + ('--> OK') ;
|
|
|
+ tm.Interval := 1000 ;
|
|
|
+ fmOAR.Visible := True ;
|
|
|
+ Application.BringToFront ;
|
|
|
+ Application.ProcessMessages ;
|
|
|
+ M.Text := msg ;
|
|
|
+ tm.Enabled := True ;
|
|
|
+ end ;
|
|
|
+ end;
|
|
|
+
|
|
|
+procedure TfmOAR.FormCreate(Sender: TObject);
|
|
|
+ begin
|
|
|
+ Application.OnActivate := ApplicationActivate ;
|
|
|
+ end;
|
|
|
+
|
|
|
+procedure TfmOAR.tmTimer(Sender: TObject);
|
|
|
+ begin
|
|
|
+ Application.Terminate ;
|
|
|
+ end;
|
|
|
+
|
|
|
+end.
|