Einzelnen Beitrag anzeigen

Popov
(Gast)

n/a Beiträge
 
#32

AW: VirtualStringTree - Nodes hinzufügen

  Alt 25. Mär 2014, 00:00
Delphi-Quellcode:
procedure GetFilesOL(SearchPath: String; ObjectList: TObjectList; SubFolder: Boolean);
var
  SearchRec: TSearchRec;
  FileInfo: TFileInfoEx2;
begin
  SearchPath := IncludeTrailingPathDelimiter(SearchPath);

  if FindFirst(SearchPath + '*.*', faAnyFile or faDirectory, SearchRec) = 0 then
  try
    repeat
      if (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
        with ObjectList do
        begin
          FileInfo := TFileInfoEx2.Create;
          Add(FileInfo);

          FileInfo.Path := SearchPath;
          FileInfo.Name := SearchRec.Name;
          FileInfo.SearchRec := SearchRec;
        end;
    until FindNext(SearchRec) <> 0;
  finally
    FindClose(SearchRec);
  end;

  //----------------------------------------------------------------------------

  if SubFolder then
  begin
    if FindFirst(SearchPath + '*.*', faDirectory, SearchRec) = 0 then
    try
      repeat
        if ((SearchRec.Attr and faDirectory) = faDirectory) and
          (SearchRec.Name <> '.') and (SearchRec.Name <> '..') then
          GetFilesOL(SearchPath + SearchRec.Name, ObjectList, SubFolder);
      until FindNext(SearchRec) <> 0;
    finally
      FindClose(SearchRec);
    end;
  end;
end;
  Mit Zitat antworten Zitat