大家帮忙呀!如何获得文件及文件夹的各种属性 delphi 中如何获得一个文件及文件夹的各种属性 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 [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 ... //隐藏 http://expert.csdn.net/Expert/topic/1515/1515339.xml?temp=.3538782 1. 在interface下的uses中引用filectrl单元2. 首先取文件属性 var attr : integer; filename : string; begin filename := 'myfile'; attr := FileGetAttr(filename); end;3. 设置文件属性(如设置归档属性 -> faArchive ) attr := attr or faArchive; //如要去掉某一属性,则如下句 attr := attr and (not faArchive); //保留其它属性 if FileSetAttr(filename, attr)=0 then //成功代码 else //失败代码4. 附文件属性常量 Constant Value Description faReadOnly $00000001 Read-only files 只读文件 faHidden $00000002 Hidden files 隐藏文件 faSysFile $00000004 System files 系统文件 faVolumeID $00000008 Volume ID files 卷标文件 faDirectory $00000010 Directory files 目录 faArchive $00000020 Archive files 归档文件 faAnyFile $0000003F Any file 任意文件 转的太乱重发一篇1. 在interface下的uses中引用filectrl单元2. 首先取文件属性var attr : integer; filename : string; begin filename := 'myfile'; attr := FileGetAttr(filename);end;3. 设置文件属性(如设置归档属性 -> faArchive ) attr := attr or faArchive; //如要去掉某一属性,则如下句 attr := attr and (not faArchive); //保留其它属性 if FileSetAttr(filename, attr)=0 then //成功代码 else //失败代码4. 附文件属性常量 Constant Value Description faReadOnly $00000001 Read-only files 只读文件 faHidden $00000002 Hidden files 隐藏文件 faSysFile $00000004 System files 系统文件 faVolumeID $00000008 Volume ID files 卷标文件 faDirectory $00000010 Directory files 目录 faArchive $00000020 Archive files 归档文件 faAnyFile $0000003F Any file 任意文件 用一个常用函数就可以搞掂:文件属性:function FileGetAttr(const FileName: string): Integer; 那么象.DOC文件中的 文件名 作者 创建时间 访问时间 标题 主题 关键字等等是如何获得的呀 回 flyhot(阳光清晨) : 仍然不能得到文件名 作者 标题 主题 关键字等信息 在DELPHI 汉字截取了,怎么弄好? 关于socket的传递Record记录集问题,请高手进接! 请教一个难题! 怎么样在MACHINE-REPORT打印之前,用代码设计页边距???急~~` TFrame要如何用才好啊? 得到任意字符的ASCII码究竟用什么函数? 如何给记录加序号啊?? 用SQL语句怎样将表中的多条记录的某字段的数据改为null? 如何拷贝文件啊 问一个关于clientdataset的菜鸟问题 stringgrid组件怎样使每一个小格可写 用TQUERY删除数据后,在提交数据时说数据集状态不可编辑,如何修改TQUER才能行呀
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 attr : integer; filename : string; begin filename := 'myfile'; attr := FileGetAttr(filename); end;3. 设置文件属性(如设置归档属性 -> faArchive )
attr := attr or faArchive; //如要去掉某一属性,则如下句 attr := attr and (not faArchive); //保留其它属性 if FileSetAttr(filename, attr)=0 then //成功代码 else //失败代码4. 附文件属性常量
Constant Value Description
faReadOnly $00000001 Read-only files 只读文件
faHidden $00000002 Hidden files 隐藏文件
faSysFile $00000004 System files 系统文件
faVolumeID $00000008 Volume ID files 卷标文件
faDirectory $00000010 Directory files 目录
faArchive $00000020 Archive files 归档文件
faAnyFile $0000003F Any file 任意文件
重发一篇1. 在interface下的uses中引用filectrl单元2. 首先取文件属性
var
attr : integer;
filename : string;
begin
filename := 'myfile';
attr := FileGetAttr(filename);
end;3. 设置文件属性(如设置归档属性 -> faArchive )
attr := attr or faArchive; //如要去掉某一属性,则如下句
attr := attr and (not faArchive); //保留其它属性
if FileSetAttr(filename, attr)=0 then
//成功代码
else
//失败代码4. 附文件属性常量
Constant Value Description
faReadOnly $00000001 Read-only files 只读文件
faHidden $00000002 Hidden files 隐藏文件
faSysFile $00000004 System files 系统文件
faVolumeID $00000008 Volume ID files 卷标文件
faDirectory $00000010 Directory files 目录
faArchive $00000020 Archive files 归档文件
faAnyFile $0000003F Any file 任意文件
文件属性:
function FileGetAttr(const FileName: string): Integer;
文件名 作者 创建时间 访问时间 标题 主题 关键字等等
是如何获得的呀
仍然不能得到文件名 作者 标题 主题 关键字等信息