如何通过api,shellexcute函数来察看文件属性,各位有代码,或实例吗?请赐教

解决方案 »

  1.   

    ◇[DELPHI]处理文件属性
    attr:=filegetattr(filelistbox1.filename);
    if (attr and faReadonly)=faReadonly then ... //只读
    if (attr and faSysfile)=faSysfile then ... //系统
    if (attr and faArchive)=faArchive then ... //存档
    if (attr and faHidden)=faHidden then ... //隐藏
      

  2.   

    uses ShellApi;procedure GetFileAttr(FileName:string);
    var
      sei:TSHELLEXECUTEINFO;
    begin
       ZeroMemory(@sei,sizeof(TSHELLEXECUTEINFO));
       sei.cbSize := sizeof(sei);
       sei.lpFile := PChar(FileName);
       sei.lpVerb := 'properties';
       sei.fMask  := SEE_MASK_INVOKEIDLIST;
       ShellExecuteEx(@sei);
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      if opendialog1.Execute then
        GetFileAttr(opendialog1.FileName);
    end;