摘要载入中… 请稍等…
内容载入中… 请稍等…
| ◎→ | 本类最新 |
|
在DELPHI中映射网络驱动器 在Delphi中实现对目录拷贝、删除 在Delphi中接受文件拖放 在Delphi中定位文件位置 用代码打开屏幕保护 用Delphi编程得到OS的类型 用Delphi编码实现程序自启动 |
|
| ◎→相关资源 | |
| C语言入门视频教程 C#编程WinForm入门视频 Asp.net入门视频教程下载 VC++编程视频教程下载 VB窗体文章 HTML入门教程 Deiphi实例教程 Deiphi窗体文章 Deiphi数据库编程 Deiphi网络编程 Deiphi图形图象文章 Deiphi系统文件 | |
| ◎→ | 热门资源 |
| 反查漢字拼音 防止多个实例公用程序 防止关闭windows 放置任意的文件到Delphi的EXE文件 倪光南力挺中国文档标准 网银17200元神秘蒸发 动画关闭窗口的示例 |
|
想要读取一个文件的属性,就要用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}
| 芯友网版权所有 1999-2006 | 著作权与商标声明 | 法律声明 | 服务条款 | 隐私声明 | 联系我们 |