请问,如何判定A盘中有没有插入软盘?(10分)

  • 主题发起人 主题发起人 boyis11
  • 开始时间 开始时间
B

boyis11

Unregistered / Unconfirmed
GUEST, unregistred user!
请问,如何判定A盘中有没有插入软盘?
 
procedure TForm1.Button1click(Sender : TObject);
begin
if not directoryexists('a:/') then
MessageDlg('没有软盘。',mtError,[mbOk],0)
else
{ 进行磁盘操作 }
end;
 
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
Raise EConvertError.Create('Not a valid drive ID');
ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
Try
If DiskSize(Ord(Drive) - $40) = -1 Then
Result := False
Else
Result := True;
Finally
SetErrorMode(ErrorMode);
End;
End;
 
多人接受答案了。
 
后退
顶部