PRocedure TForm1.Button2Click(Sender: TObject); begin with MediaPlayer1 do if (MediaPlayer1.Mode = mpOpen) then mciSendCommand(MediaPlayer1.DeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, 0) else mciSendCommand(MediaPlayer1.DeviceID, MCI_SET, MCI_SET_DOOR_OPEN, 0); end;