CD-ROM
  1. Audio CD
  2. how to eject and close CD-Drive?

Audio CD

From: "Chris Rankin" <RankinC@Logica.com>

Vincent Oostindie <vincent.oostindie@tip.nl> wrote
> * How do I get the unique number from an audio CD in the CD-ROM drive?

const
  MCI_INFO_PRODUCT                = $00000100;
  MCI_INFO_FILE                   = $00000200;
  MCI_INFO_MEDIA_UPC              = $00000400;
  MCI_INFO_MEDIA_IDENTITY         = $00000800;
  MCI_INFO_NAME                   = $00001000;
  MCI_INFO_COPYRIGHT              = $00002000;

{ parameter block for MCI_INFO command message }
type
  PMCI_Info_ParmsA = ^TMCI_Info_ParmsA;
  PMCI_Info_ParmsW = ^TMCI_Info_ParmsW;
  PMCI_Info_Parms = PMCI_Info_ParmsA;
  TMCI_Info_ParmsA = record
    dwCallback: DWORD;
    lpstrReturn: PAnsiChar;
    dwRetSize: DWORD;
  end;
  TMCI_Info_ParmsW = record
    dwCallback: DWORD;
    lpstrReturn: PWideChar;
    dwRetSize: DWORD;
  end;
  TMCI_Info_Parms = TMCI_Info_ParmsA;

These are the buffers you want: the identifier is returned as a string of decimal digits by the MCI_INFO_MEDIA_IDENTITY function. You should be able to cross-reference this with the online help (Win32 and TMediaPlayer component).

how to eject and close CD-Drive?

From: Christian Piene Gundersen <j.c.p.gundersen@jusstud.uio.no>

ClaWenkel wrote:
>
> Is there any API command in Delphi2 to eject AND CLOSE the CD-ROM Drive
> physically e.g. by clicking on a button? I don't want to use the
> TMediaPlayer component (which can only eject...)
> thanks in advance, ClaWenkel

To open the CD-ROM:


        mciSendString('Set cdaudio door open wait', nil, 0, handle); 

To close the CD-ROM:


        mciSendString('Set cdaudio door closed wait', nil, 0, handle); 

Remember to include the MMSystem unit in your uses clause.


Please email me and tell me if you liked this page.