DELPHI和VB使用的本来就不是一套类库
你可以使用 TFileListBox类
for i:=0 to FileListBox.Items.Count-1 do
  FileListBox.Items[i]

解决方案 »

  1.   

    他想找目录
    还是TDirectoryListBox合适吧?
      

  2.   

    给你两个函数procedure FindDirUnder(strDir:string;IncludeSelf:boolean;var DirList:TStringList);
    //读取StrDir目录下的所有直接子目录到DirList中
    var
      SRec: TSearchRec;
      retval: Integer;
    begin
      DirList.Clear;
      retval:=FindFirst(strDir+'\*.*',faDirectory,sRec);
      try
        while retval=0 do
        begin
          if (SRec.Attr and faDirectory)<>0 then
            if (Srec.Name='.')or(Srec.Name='..')then
            begin
              if IncludeSelf then
                DirList.Add(Srec.Name)
            end else
              DirList.Add(Srec.Name);
          retval:=FindNext(SRec);
        end;
      finally
        FindClose(SRec);
      end;
    end;procedure FindFileUnder(strDir,ExtName:string;var FileList:TStringList);
    //读取StrDir目录下的所有文件到FileList中
    var
      SRec: TSearchRec;
      retval: Integer;
    begin
      FileList.Clear;
      retval:=FindFirst(strDir+'\'+ExtName,faAnyFile,sRec);
      try
        while retval=0 do
        begin
          if (SRec.Attr and faDirectory)=0 then
            FileList.Add(Srec.Name);
          retval:=FindNext(SRec);
        end;
      finally
        FindClose(SRec);
      end;
    end;
      

  3.   

    入乡随俗,到了delphi的世界,就应该使用Delphi的方法。上面几位说的都对。只有VB和C#才有ForEach,C++和Java也没有,放宽你的心情吧。
      

  4.   

    最简单的for i:=1 to count do begin
      j:=i;
       subfolders[j]去访问end
    j是olevarint
      

  5.   

    对,filelistbox挺好用的,简单