Listing 1:
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+' Door Closed'), nil, 0, 0);
mciSendString(pChar('Close '+DriveLetter+': Alias ' +Alias+' Type CDAudio'), nil, 0, 0);
End;
Listing 2:
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+' Door Open'), nil, 0, 0);
mciSendString(pChar('Close '+DriveLetter+': Alias ' +Alias+' Type CDAudio'), nil, 0, 0);
End;