◇[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 ... //隐藏
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;
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 ... //隐藏
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;