本文整理自网络,侵删。
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屏蔽win、ctrl_esc、alt_tab、alt_f4等键(windows xp、windows 2003 server下测试通过)
Delphi indy tidhttp tidhttpserver post get
Delphi idhashmessagedigest 获取文件md5
更多相关阅读请进入《Delphi》频道 >>