本文整理自网络,侵删。
function DiskInDrive(Drive: Char): Boolean;
var ErrorMode: word;
begin
if Drive in ['a'..'z'] then Dec(Drive, $20);
if not (Drive in ['A'..'Z']) then
begin
Result := False;
Exit;
end;
ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
try
if DiskSize(Ord(Drive) - $40) = -1 then
Result := False
else
Result := True;
finally
SetErrorMode(ErrorMode);
end;
end;
相关阅读 >>
Delphi 使用 {$include} 或 {$i} 指令管理和调用自定义函数
Delphi 如何让 tgpimage 直接从流中加载图片?
Delphi sysutils.comparetext的注释
Delphi messagebox 和 messagedlg用法
更多相关阅读请进入《Delphi》频道 >>