Articles

Use mciSendString function. If you will press button1, then cd-rom will be opened. If you will press button2, then cd-rom will be closed.

procedure TForm1.Button1Click(Sender: TObject);
begin
  mciSendString('Set cdaudio door open wait', nil, 0, Handle);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  mciSendString('Set cdaudio door closed wait', nil, 0, Handle);
end;