function   GetChildDir(const   AParentDir:   string):   Tstringlist; 
var 
    Dir:   TSearchRec; 
    Ret:   integer; 
    Path:   string; 
begin 
    Result:=Tstringlist.Create; 
    try 
        Path   :=   ExtractFilePath(AParentDir); 
        Ret   :=   Sysutils.FindFirst(AParentDir,   faAnyFile,   Dir); 
        if   Ret   <>   NO_ERROR   then   exit; 
        try 
            while   ret=NO_ERROR   do 
            begin 
                if   (Dir.Attr   in   [faDirectory])   and   (Dir.Name[1]   <>   '. ')   then 
                begin 
                    Result.Add(Dir.name); 
                    Result.addstrings(GetChildDir(Path   +   Dir.Name   +   '\*.* ')); 
                end; 
                Ret   :=   Sysutils.FindNext(Dir); 
            end; 
        finally 
            Sysutils.FindClose(Dir); 
        end; 
    except 
        Result.Free; 
    end; 
end;

调用这个函数,再把返回值读入LISTBOX就可以了。

相关文章:

  • 2022-01-19
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-12
  • 2021-10-25
  • 2022-03-01
  • 2022-12-23
  • 2021-07-19
  • 2022-01-21
  • 2022-12-23
相关资源
相似解决方案