findfirst,findnext,findclose,TSearchRec
其实用 TFileListBox。filelist最简单

解决方案 »

  1.   

    TFileListBox能列出本目录下所有文件
    用它的Items属性能得到所有文件名
      

  2.   

    还有一个问题,work中怎样设置页的行数和每行字数?
      

  3.   

    还有我想删除此目录下的所有文件呢>?
    用DELETEFILE?
      

  4.   

    var
      rc:TSearchRec;用findfirst('c:\ling\*.*',faAnyFile,rc);
    我知道此目录下肯定有文件存在。
    为什么rc.name的返回值是'.'?
      

  5.   

    这是因为DOS有两个
    1. .
    2. ..
      

  6.   

    1.if rc.name <> '.' or rc.name <> '..' then
    2.
    procedure TFMForm.Properties1Click(Sender: TObject);
    var
      Attributes, NewAttributes: Word;
    begin
      with FileAttrForm do
      begin
        FileDirName.Caption := FileList.Items[FileList.ItemIndex];
        { set box caption }
        PathName.Caption := FileList.Directory;
        { show directory name }
        ChangeDate.Caption := 
          DateTimeToStr(FileDateToDateTime(FileAge(FileList.FileName)));
        Attributes := FileGetAttr(FileDirName.Caption);
        { read file attributes }
        ReadOnly.Checked := (Attributes and faReadOnly) = faReadOnly;
        Archive.Checked := (Attributes and faArchive) = faArchive;
        System.Checked := (Attributes and faSysFile) = faSysFile;
        Hidden.Checked := (Attributes and faHidden) = faHidden;
        if ShowModal <> id_Cancel then { execute dialog box }
        begin
          NewAttributes := Attributes;
          { start with original attributes }
          if ReadOnly.Checked then
            NewAttributes := NewAttributes or faReadOnly
          else 
            NewAttributes := NewAttributes andnot faReadOnly;
          if Archive.Checked then
            NewAttributes := NewAttributes or faArchive
          else 
            NewAttributes := NewAttributes andnot faArchive;
          if System.Checked then 
            NewAttributes := NewAttributes or faSysFile
          else 
            NewAttributes := NewAttributes andnot faSysFile;
          if Hidden.Checked then 
            NewAttributes := NewAttributes or faHidden
          else 
            NewAttributes := NewAttributes andnot faHidden;
          if NewAttributes <> Attributes then { if anything changed... }
            FileSetAttr(FileDirName.Caption, NewAttributes);
             { ...write the new values }
        end;
      end;
    end;
      

  7.   

    这两个一定是前两个,直接跳过就行了,或者用SearchRec.Name[1]<>′.′判断 用filesetattr(filename,faarchive)去掉所有特殊属性