Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Exit ?! (https://www.delphipraxis.net/87561-exit.html)

MatWur 3. Mär 2007 07:34

Re: Exit ?!
 
Zitat:

Zitat von -187-
Delphi-Quellcode:
  Procedure SearchingFiles(Filename:String);
begin
  if SearchForFile(GetSysDir+'\', Filename, APathFound) then
    WriteLn(myFile,':: Available: '+GetSysDir+'\'+Filename) else
    WriteLn(myFile,':: Missing: '+GetSysDir+'\'+Filename);
    end;
Ich möchte das dass Programm schließt wenn die Datei nich vorhanden ist. Also sowas wie

Delphi-Quellcode:
else
    WriteLn(myFile,':: Missing: '+GetSysDir+'\'+Filename) AND EXIT;
Wie mach ich das , ich möchte nich nochmal extra eine if File Exists durchführen..

Die AND-Anweisung vor dem Exit ist hier irgendwie nicht sinnvoll. Exit beendet die aktuelle Prozedur/Funktion/Routine, nicht das Programm.

probier mal Application.terminate;

mfg

Matthias

Namenloser 3. Mär 2007 10:27

Re: Exit ?!
 
Warum nicht einfach so? Halt ist genau das, was du suchst. (für application.close musst du die unit forms einbinden, die dein programm aber nur unnötig ausbläht)

Delphi-Quellcode:
  if SearchForFile(GetSysDir+'\', Filename, APathFound) then
    WriteLn(myFile,':: Available: '+GetSysDir+'\'+Filename)
  else
  begin
    WriteLn(myFile,':: Missing: '+GetSysDir+'\'+Filename);
    halt;
  end;

Steve 3. Mär 2007 14:48

Re: Exit ?!
 
Genau das habe ich doch auch geschrieben :gruebel:


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:13 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz