Der Start eines Programmes entspricht nicht dem OnCreate Ereignis der Hauptform.
Geh mal in den Projektquelltext (unter D7: Projekt - Quelltext anzeigen).
Der sieht bei einem gänzlich neuen Programm so aus:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
| program Project1;
uses Forms, Unit1 in 'Unit1.pas' ;
{$R *.res}
begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. |
Nun fügst du ein paar If Blöcke ein, mitdenen kontrolliert wird, ob bestimmte Dateien existieren. Denke daran, die Units SysUtils und Dialogs einzubinden!
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| program Project1;
uses Forms, Dialogs, SysUtils, Unit1 in 'Unit1.pas' ;
{$R *.res}
begin If (not FileExists('C:\lalala.test')) or (not FileExists('C:\Uftata.test')) or (not FileExists('C:\Mucke.test')) then begin ShowMessage('So geht das nicht hier!'); Application.Terminate; end; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. |
Schon wird deine Anwendung gar nicht erst initialisiert, wenn die Dateien fehlen.