使用FindFirst, FindNext, FindClose等函数的协同完成枚举的工作。

解决方案 »

  1.   

    我强烈建议你看看delphi的例子virtuallistview
    写得很详细
      

  2.   

    我有例子 
     [email protected]
      

  3.   

    to lwm8246:
      不要光说不炼,把你的例子公布出来。
      留你的E_mail有何用!
      

  4.   

    你看应该搜索一下以前的问题,有答案的。这个 递归检索 传进路径下的所有路径和文件。
    procedure TForm1.DoSearchPathFile(qPath: string);
    var
      SR: TSearchRec;
      FileAttr: Integer;
    begin
      FileAttr := faDirectory;
      FindFirst(qPath  + '\*.*', FileAttr, SR);  While FindNext(SR) = 0 do
      begin
        if (SR.Name <> '.') and (SR.Name <> '..') then begin
          if DirectoryExists(qPath + '\' + SR.Name) then
          begin
            ListBox1.Items.Add('路径'+ qPath + '\' + SR.Name);
            DoSearchPathFile(qPath + '\' + SR.Name);      end;
          //;else ListBox1.Items.Add(qPath + '\' + SR.Name);    end;
      end;  FileAttr := faAnyFile;  FindFirst(qPath + '\*.*', FileAttr, SR);
      while FindNext(SR) = 0 do
      begin
        if (SR.Name <> '.') and (Sr.Name <> '..') then
        begin
          if not(DirectoryExists(qPath + '\' + SR.Name)) then
            ListBox1.Items.Add(qPath + '\' + SR.Name);
        end;
      end;
    end;