1。在DELPHI中用哪个控件能列出一个目录下的所有文件名,在哪个面版?我要对这些文件进行改名和删除操作。
2。如果用你所指的这个控件怎样列出?写点代码,谢谢

解决方案 »

  1.   

    TFileListBox
    TShellListView
    or
    第三方的
    TPTShellList
      

  2.   

    在win31面板上的TFileListBox列出文件名,,,代码你地不用写地:)祝:身体健康,答案和分数同样重要!!
      

  3.   

    TFileListBox有问题请发信息到我的E-mail:[email protected]
      

  4.   

    TO:上面四位哥哥,这是一个OCX,放在:e:\delphi\abc ,如果我所显示的不是一个指定目录内的文件(e:\delphi\abc,不能用全目录。),而是一个相对目录(如:abc\)下,abc名是一定的不变。怎么办?
      

  5.   

    相对目录啊,,用函数指定你abc\的前一个目录,,然后用abc\就可以了呀setcurrentdir你搜一下这个字符串在帮助中,
      

  6.   

    TO: ghyghost(著名关心CSDN结贴率爱国主义人士代表) 
    setcurrentdir返回的是bool值。。
    我就是不晓得怎么去指定一个不知在哪个盘哪个地方的目录,只晓得要显示的文件在目录名为:abc下,怎么办?怎样指定指定目录后FileListBox1.refresh 内的值不变呀!
      

  7.   

    property Directory设置工作目录!
    配合ExtractFilePath,ParamStr(0)等就可以定位相对目录的我还不清楚你的意图
      

  8.   

    你可以用
    Getcurrentdir获得当前目录
    ExtractFilePath获得当前路径
    有问题请发信息到我的E-mail:[email protected]
      

  9.   

    目录不晓得在哪个盘,哪个目录下?
    可以使用递归查找系统的所有驱动器算法可以在网上找到
    或者:(只是方法,你还要修改一下的)
    procedure TForm1.MakeTree;
    var  Sr : TSearchRec;
         Err: integer;
         s, TrSize, FilePath : string;
    Begin
     Application.ProcessMessages; 
     Err:=FindFirst('*.*',$37,Sr) ;
     While (Err = 0) do
      begin
       if Sr.Name[1]<>'.' then
       begin
         FilePath:=ExpandFileName(Sr.Name);
         TreeSize:=TreeSize+Sr.Size;
         TrSize:=FloatToStr(TreeSize);
         ScanProgress.Caption:=sr.Name;
         if (maxcount<1) or (searchcount<=maxcount) then
            begin
              s:=extractfilepath(filepath)+sr.Name;
              if ExtList.Items.Count=0 then inc(searchcount) else
              if ExtList.Items.IndexOf('.*')>-1 then
                 begin
                   form2.Memo1.Lines.Add(s+'     '+inttostr(sr.size)+' Bytes');
                   SearchSize:=SearchSize+sr.Size;
                   inc(searchcount);
                 end else
                   if ExtList.Items.IndexOf(AnsiLowerCase(extractfileext(sr.name)))>-1 then
                      begin
                        if DelFile.Checked then
                           if DelToRecycled(s)
                              then form2.Memo1.Lines.Add('Delete !!!!  '+s+'     '+inttostr(sr.size)+' Bytes')
                              else form2.Memo1.Lines.Add('Delete fail  '+s+'     '+inttostr(sr.size)+' Bytes')
                           else form2.Memo1.Lines.Add(s+'     '+inttostr(sr.size)+' Bytes');
                        SearchSize:=SearchSize+sr.Size;
                        inc(searchcount);
                      end;
            end;
         if (Sr.Attr and faDirectory)=0 then
            begin
              FilesSize:=FilesSize+Sr.Size;
              inc(FilesCount);
            end;
         inc(TreeCount);
       end;   { Begin Recursion }
       If ((Sr.Attr and faDirectory)<>0)AND(Sr.Name[1] <> '.') then
       begin
         DirsSize:=DirsSize+Sr.Size;
         inc(DirsCount);
         ChDir(Sr.Name) ;
         MakeTree ;
         ChDir('..') ;
       end ;
       { End Recursion }
       Err:=FindNext(Sr) ;
      end ;
    End;procedure TForm1.ScanButtonClick(Sender: TObject);
    begin
     TreeCount:=1;
     FilesCount:=0;
     DirsCount:=0;
     TreeSize:=0;
     FilesSize:=0;
     DirsSize:=0;
     Searchcount:=0;
     SearchSize:=0;
     form2.Memo1.Clear;
     ChDir(DirectoryListBox1.Directory);
     screen.Cursor:=crhourglass;
     MakeTree;
     screen.Cursor:=crdefault;
     Form2.Show;
    end;