FileSetAttr去掉文件隐藏属性后,隐藏属性复选框变成灰色了......

jwejo 2010-05-12 11:33:27
var:
s:sting;
FileSetAttr(s,not faHidden);

为什么复选框变灰了呢?
怎么才能不变灰?
...全文
215 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Harryfin 2010-05-13
  • 打赏
  • 举报
回复
sysutils居然又有一个封装了的函数...
JPEXE 2010-05-12
  • 打赏
  • 举报
回复
试试这样:
{ 去掉文件的隐藏属性 }
FileSetAttr(FileName, (FileGetAttr(FileName) and (not faHidden)));
jwejo 2010-05-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 harryfin 的回复:]
这个是你自己写的函数吧,WINAPI的标准函数叫SetFileAttributes,自己检查一下。
[/Quote]

Sets the file attributes of a specified file.

Unit

SysUtils

Category

file management routines

function FileSetAttr(const FileName: string; Attr: Integer): Integer;

Description

FileSetAttr sets the file attributes of the file given by FileName to the value given by Attr. The value of Attr is formed by combining the appropriate file attribute constants, as in the following:

FileSetAttr('MyFile.sys', faReadOnly or faSysFile);

FileSetAttr returns zero if the function was successful. Otherwise the return value is an error code.

Note: See TSearchRec for a description of the file attribute constants.
Harryfin 2010-05-12
  • 打赏
  • 举报
回复
这个是你自己写的函数吧,WINAPI的标准函数叫SetFileAttributes,自己检查一下。
jwejo 2010-05-12
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 jpexe 的回复:]
试试这样:

Delphi(Pascal) code
{ 去掉文件的隐藏属性 }
FileSetAttr(FileName, (FileGetAttr(FileName) and (not faHidden)));
[/Quote]

嗯,这个可以

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧