人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開發(fā)教程 > 詳細頁面

改變文件的屬性

改變文件的屬性

更新時間:2022-09-24 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

想要讀取一個文件的屬性,就要用FileGetAttr函數(shù)調(diào)用文件名,即將文件屬性返回到一指定文件。例如,添加一個Tbutton和Tlabel組件到窗體并添加如下代碼:

var
  attr:Integer;
  s:string;
begin
  attr:=FileGetAttr('c:\Autoexec.bat');
  if(attr and faHidden)<>0 then s:='Hidden';
  if(attr and faReadOnly)<>0 then s:=s+'Read-Only';
  if(attr and faSysFile)<>0 then s:=s+'System';
  if(attr and faArchive)<>0 then s:=s+'Archive';
  Label1.Caption:=s;
end;
---------------------------
    要想設(shè)置某個文件的屬性,將你想要改變的文件名和要改的屬性傳遞到函數(shù)FileSetAttr。每種屬性都在SysUtils單元中定義了一個名稱。要設(shè)置某個文件的屬性,請您跟著做下去:

Attributes := Attributes or faSystem;

//也可以同時設(shè)置幾個屬性:

Attributes := Attributes and not (faReadOnly or faHidden);
---------------------------
//另外,為了改變文件屬性,可以使用下面的返回值。
     +----------------------------------+
     | 返回值 | 文件屬性 |
     +----------------------------------+
     | 128 | Normal |
     | 1 | Read Only |
     | 2 | Hidden |
     | 4 | System |
     | 32 | Archive |
     +--------------+-------------------+

調(diào)用示例:我們將用到如下代碼

FileSetAttr('C:\Autoexec.bat',2);{隱藏}
FileSetAttr('C:\Autoexec.bat',3);{隱藏、只讀。FileGetAttr 返回值3} 

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 天全县| 汉阴县| 宁陕县| 韩城市| 临高县| 安顺市| 藁城市| 庆城县| 莱西市| 丹阳市| 中超| 湘阴县| 安阳县| 东乌珠穆沁旗| 兴城市| 措勤县| 弋阳县| 元朗区| 延津县| 宾阳县| 青浦区| 海丰县| 唐山市| 金沙县| 大埔县| 鹤庆县| 青浦区| 鄂伦春自治旗| 大新县| 湄潭县| 招远市| 含山县| 会昌县| 宣威市| 凤山市| 潞西市| 乾安县| 湟中县| 上林县| 方山县| 彰化县|