判斷驅動器是否准備好,如軟盤,光驅的函數
function IsDiskReady(Drive: char): boolean;
var
d1, d2, d3, d4: longword;
DrivePath: array [0..3] of char;
begin
DrivePath := :;
DrivePath[0] := Drive;
Result := GetDiskFreeSpace(DrivePath, d1, d2, d3, d4);
end;
調用例子:
if not IsDiskReady(A) then
ShowMessage(驅動器 A: 未准備好)
else showmessage(驅動器 A: 准備好);
彈出或關閉cd-rom 函數(要加入 MMSystem 單元)
procduere Eject(YesOrNo: Boolean);
begin
if YesOrNo then
mciSendstring(SET CDAUDIO DOOR OPEN WAIT,nil,0, Handle)
else mciSendstring(SET CDAUDIO DOOR CLOSED WAIT,nil,0, Handle);
end;