在PB中如何更改文件属性?比如取消某文件的只读属性。

sfaf 2002-03-11 01:15:56
谢谢!
...全文
118 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
byfq 2002-03-11
  • 打赏
  • 举报
回复
up
sincerity 2002-03-11
  • 打赏
  • 举报
回复
API函数:
FUNCTION ulong SetFileAttributesA(ref string lpFileName,ulong dwFileAttributes) LIBRARY "kernel32.dll"

举例:
string ls_file

ls_file = "c:\test.txt"

SetFileAttributesA(ls_file,0)
dwFileAttributes 既是文件的属性参数,为0是去除所有属性。
pbsql 2002-03-11
  • 打赏
  • 举报
回复
FUNCTION boolean SetFileAttributesA(ref string filename,string filepropertiy) LIBRARY "Kernel32.dll"
例:SetFileAttributesA(ls_cto,"-r")//取消只读属性
daiwoo_wang 2002-03-11
  • 打赏
  • 举报
回复
Declare Function SetFileAttributes Lib "kernel32" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
说明
设置文件属性
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数 类型及说明
lpFileName String,要设置其属性的文件名
dwFileAttributes Long,带有FILE_ATTRIBUTE_??前缀的一个或多个常数

如果不知函数属性,可用相似的GetFileAttribute得到函数属性。

401

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 非技术版
社区管理员
  • 非技术版社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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