同上

解决方案 »

  1.   

    GetFileAttributes    <----这个API可以解决问题
    The GetFileAttributes function retrieves attributes for a specified file or directory. This function retrieves a set of FAT-style attribute information. The GetFileAttributesEx function can obtain other sets of file or directory attribute information. DWORD GetFileAttributes(
      LPCTSTR lpFileName   // name of file or directory
    );
    Parameters
    lpFileName 
    [in] Pointer to a null-terminated string that specifies the name of a file or directory. 
    Windows NT/2000: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions. Windows 95/98: This string must not exceed MAX_PATH characters. 
      

  2.   

    use sysutils
    procedure TForm1.Button1Click(Sender:TObject);
    begin
      case FileGetAttr('c:\command.dos') of
           faReadOnly:showmessage('只读');
           faHidden:...
           faSysfile:...
           faVolumeID:...
           faDirectory:...
           faArchive:...
           faAnyFile:...
      else
           showmessage('文件不详');
    end;
      

  3.   

    再问一个问题:怎样使用
    function GetFileSize(hFile: THandle; lpFileSizeHigh: Pointer): DWORD; stdcall;
    这个函数只知道路径和文件名?谢谢
      

  4.   

    使用createfile后返回的文件句柄,具体的你要看createfile的帮助了