Procedure CloseDoor(Driveletter:Char);
Var
Alias : String;
begin
Alias:='Drive'+DriveLetter;
mciSendString(pChar('Open '+DriveLetter+': Alias ' +Alias+' Type CDAudio'), nil, 0, 0);
mciSendString(pChar('Set '+Alias+'do
or Closed'), nil, 0, 0);
mciSendString(pChar('Close '+DriveLetter+': Alias ' +Alias+' Type CDAudio'), nil, 0, 0);
end;
Procedure OpenDoor(Driveletter:Char);
Var
Alias : String;
begin
Alias:='Drive'+DriveLetter;
mciSendString(pChar('Open '+DriveLetter+': Alias ' +Alias+' Type CDAudio'), nil, 0, 0);
mciSendString(pChar('Set '+Alias+'do
or Open'), nil, 0, 0);
mciSendString(pChar('Close '+DriveLetter+': Alias ' +Alias+' Type CDAudio'), nil, 0, 0);
end;
例如 OpenDoor(Edit1.Text[1]);