大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> 程序开发 -> 改变文件的属性

改变文件的属性

时间: 2021-07-31 作者:daque

想要读取一个文献的属性,就要用filegetattr因变量挪用文献名,行将文献属性归来到一指定文献。比方,增添一个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;---------------------------    要想树立某个文献的属性,将你想要变换的文献名和要改的属性传播到因变量filesetattr。每种属性都在sysutils单位中设置了一个称呼。要树立某个文献的属性,请您随着做下来:attributes := attributes or fasystem; //也不妨同声树立几个属性: attributes := attributes and not (fareadonly or fahidden); --------------------------- //其余,为了变换文献属性,不妨运用底下的归来值。     +----------------------------------+     | 归来值 | 文献属性 |     +----------------------------------+     | 128 | normal |     | 1 | read only |     | 2 | hidden |     | 4 | system |     | 32 | archive |     +--------------+-------------------+ 挪用示例:咱们将用到如次代码filesetattr('c:\autoexec.bat',2);{湮没} filesetattr('c:\autoexec.bat',3);{湮没、只读。filegetattr 归来值3} 

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.