送你一个例子吧:
procedure TForm1.Button1Click(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;

解决方案 »

  1.   

    API
    The GetFileAttributes function returns attributes for a specified file or directory. DWORD GetFileAttributes(    LPCTSTR lpFileName  // address of the name of a file or directory  
       );
     ParameterslpFileNamePoints to a null-terminated string that specifies the name of a file or directory. Windows NT:There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the GetFileAttributes function parses paths. An application can transcend this limit and send in paths longer than MAX_PATH characters by calling the wide (W) version of GetFileAttributes and prepending "\\?\" to the path. The "
    \\?\" tells the function to turn off path parsing; it lets paths longer than MAX_PATH be used with GetFileAttributesW. This also works with UNC names. The "\\?\" is ignored as part of the path. For example, "
    \\?\C:\myworld\private" is seen as "C:\myworld\private", and "\\?\UNC\bill_g_1\hotstuff\coolapps" is seen as "\\
    bill_g_1\hotstuff\coolapps".Windows 95:The lpFileName string must not exceed MAX_PATH characters. Windows 95 does not support the "\\?\" prefix. Return ValuesIf the function succeeds, the return value contains the attributes of the specified file or directory.
    If the function fails, the return value is 0xFFFFFFFF. To get extended error information, call GetLastError. 
    The attributes can be one or more of the following values:
      

  2.   

    模仿?根据WINDOWS出现的那个窗口自己写代码找比如文件大小,创建时间等??
    是不是这样?
      

  3.   

    那怎么判断如 'C:\Windows\Log' 这个Log到底是文件夹还是文件?如果刚好有一个LOG的文件夹跟一个log.txt的文件呢?要怎么办?
    thanks!
    等一下再加分!
      

  4.   

    判断是文件还是文件夹:
     if fileexists(StrName) then
       showmessage('是文件');