Delphi 测试磁盘是否具有写访问权限
2022-12-25 16:24:12 作者:admin
本文整理自网络,侵删。
Delphi 测试磁盘是否具有写访问权限
function CanWrite(drive: string): boolean; var OldMode: Cardinal; begin OldMode := SetErrorMode(SEM_FAILCRITICALERRORS); try with TStringList.Create do try SaveToFile(drive + ':\file.txt'); result := true;
try deletefile(drive + ':\file.txt'); except end; except result := false; end; finally SetErrorMode(OldMode); end;end;
调用
if CanWrite('g') = true then begin showmessage('可以写'); end else begin showmessage('不能写');end;
来源:http://www.xuexidashi.vip/h-nd-1629.html#_np=125_826
相关阅读 >>
Delphi 得到ip三个值
Delphi copyfileprogressbar 拷贝文件显示进度条
Delphi 从 twebbrowser中获得当前输入处的链接
Delphi 控制滚动条
Delphi int64:是Delphi中最大的整数,64位有符号整数
如何在Delphi xe中通过ftp下载文件
Delphi 官方 processmessages 用法代码例子
Delphi截图程序无窗口版
Delphi windows 编程[20] - 改变菜单项并换行
Delphi nativeexcel获取excel所有列
更多相关阅读请进入《Delphi》频道 >>
猜你喜欢
联络方式:
400-123-789
邮箱:xiachao@163.com
Q Q:12345678
微信公众号
微信二维码