f:=FileSetAttr ('Unit1.pas',faReadOnly);<br> if f=0 then showmessage('Unit1.pas设为只读文件');<br> <br> {<br> faReadOnly $00000001 Read-only files<br> faHidden $00000002 Hidden files<br> faSysFile $00000004 System files<br> faVolumeID $00000008 Volume ID files<br> faDirectory $00000010 Directory files<br> faArchive $00000020 Archive files<br> faAnyFile $0000003F Any file<br> }<br>