Thema: Delphi Verzeichnis löschen...

Einzelnen Beitrag anzeigen

TBx
(Administrator)

Registriert seit: 13. Jul 2005
Ort: Stadthagen
1.875 Beiträge
 
Delphi 12 Athens
 
#9

Re: Verzeichnis löschen...

  Alt 26. Mär 2006, 13:40
nein, das FindClose steht schon an der richtigen Stelle.
[Edit]
Die Stelle, die Du eben vorgeschlagen hast, würde die Suche immer nach dem zweiten ergebnis beenden und dann unweigerlich zum Fehler führen.
[Edit/]
Du soltest das Findfirst in die Zeile vor dem try setzen.
@Christin Seehase Ein FindClose ist auch dann angesagt, wenn das FindFirst fehlschlägt:

Auszug aus SysUtils:

Delphi-Quellcode:
function ForceDirectories(Dir: string): Boolean;

{ FindFirst searches the directory given by Path for the first entry that
  matches the filename given by Path and the attributes given by Attr. The
  result is returned in the search record given by SearchRec. The return
  value is zero if the function was successful. Otherwise the return value
  is a system error code. After calling FindFirst, always call FindClose.
  FindFirst is typically used with FindNext and FindClose as follows:

    Result := FindFirst(Path, Attr, SearchRec);
    while Result = 0 do
    begin
      ProcessSearchRec(SearchRec);
      Result := FindNext(SearchRec);
    end;
    FindClose(SearchRec);

  where ProcessSearchRec represents user-defined code that processes the
  information in a search record. }
Gruß

Thomas
Thomas Breitkreuz
  Mit Zitat antworten Zitat