为什么不查查以前的回答啊,再给你贴一次。
procedure TForm1.DriveComboBox1Exit(Sender: TObject);
begin
try
if not DiskInDrive(DriveComboBox1.Drive) then
showmessage('No disk!');
except
showmessage('error');
end;
end;
function DiskInDrive(const Drive: char): Boolean;
var
DrvNum: byte;
EMode: Word;
begin
result := false;
DrvNum := ord(Drive);
if DrvNum >= ord('a') then dec(DrvNum,$20);
EMode := SetErrorMode(SEM_FAILCRITICALERRORS);
try
if DiskSize(DrvNum-$40) <> -1 then result := true
else messagebeep(0);
finally
SetErrorMode(EMode);
end;
end;