Einzelnen Beitrag anzeigen

Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#3

Re: Wie kann man "zuletzt verwendete Dokumente" au

  Alt 29. Dez 2003, 19:09
Hi,

den Inhalt eines Ordners kannst du mit dieser Funktion ermitteln:

Delphi-Quellcode:
  procedure FileList(sPath, sExt: string; bRecurse: boolean; List: TStrings);
  var
    f,
    f2: TSearchRec;
  begin
    if FindFirst(sPath + '*.*', faAnyFile, f) = 0 then
    begin
     if FindFirst(sPath + sExt, faAnyFile, f2) = 0 then
     begin
       List.Add(sPath + f2.Name);
       while FindNext(f2) = 0 do
         if (f2.Name <> '.') and (f2.Name <> '..') then List.Add(sPath + f2.Name);
     end;
     while FindNext(f) = 0 do
       if ((f.Attr and faDirectory) = faDirectory) and (f.Name <> '.')
         and (f.Name <> '..') and (bRecurse) then
           FileList(sPath + f.Name + '\', sExt, bRecurse, List);
    end; {if} 
    FindClose(f);
  end;
mfG
mirage228
David F.
  Mit Zitat antworten Zitat