![]() |
GetFILEs mit INterruption ..
Hi Leute,
ich hab das hier gelesen und komm damit nicht klar: ![]() Ich will auch das root dir nicht durchsuchen. Und hab diesen CODE: Kann mir jmd sagen, wo der Fehler liegt? DANKE
Delphi-Quellcode:
Mein Call in hörere Routine:
procedure Tform1.scandir(mypath: string);
var path : string; Predicate : function (const Path: string; const SearchRec: TSearchRec): boolean; begin if Path=extractfilepath(Savedialog12.filename) then Abort; end; Begin try for Path in TDirectory.GetFiles( mypath,'*.*',TSearchOption.soAllDirectories,Predicate) do begin Listbox2.Items.Add(Path); Memo15.Lines.Add(Path); end; except on E: EAbort do begin // canceled ... writelogmemo('Read all aborded ! '); end; end; end;
Delphi-Quellcode:
Begin listbox2.Clear; memo15.Clear; mypath:=extractfilepath(savedialog12.filename)+extractfilepath(stringreplace( stringreplace(risfn,'/','\',[rfreplaceall]),'internal-pdf:\\','',[rfreplaceall])); writelogmemo('PLEASE WAIT: Reading Files form: '+mypath); scandir(mypath); writelogmemo('Read all Files done: Count: '+inttostr(Memo15.Lines.count)); end; |
AW: GetFILEs mit INterruption ..
Wie wäre es, wenn man auf den Compiler hört, der hier hoffentlich sich über das nicht initialisierte Result beschwert?
Und warum Abort, wenn .... rate mal wofür das Result ist. :zwinker: OK, Result um den einzelnen Eintrag zu filtern und Abort zum Komplettabbruch, aber dennoch muß Result gesetzt sein. :stupid:
Delphi-Quellcode:
ist das Rootverzeichnis,
Path = mypath
aber dennoch willst du ja die Verzeichnisse darin dennoch haben, also
Delphi-Quellcode:
Result := (SearchRec.Attr and faDirectory <> 0) or (Path <> mypath);
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:29 Uhr. |
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