Jump to content

MCI_GETTOC

From EDM2

This message returns a table of contents (TOC) structure for the currently loaded compact disc.

Syntax

param1
ULONG ulParam1; /* Flags for the TOC query. */

param2
PMCI_TOC_PARMS pParam2; /* Pointer to the MCI_TOC_PARMS data structure. */

Parameters

ulParam1 (ULONG) - input
This parameter can contain any of the following flags:
  • MCI_NOTIFY A notification message will be posted to the window specified in the hwndCallback field of the data structure.
  • MCI_WAIT Control is not returned until the action is completed or an error occurs.
pParam2 (PMCI_TOC_PARMS) - input
A pointer to the MCI_TOC_PARMS data structure, which contains the buffer address and buffer size for the TOC records.

Returns

rc (ULONG) - returns
Return codes indicating success or failure:
  • MCIERR_SUCCESS 0 is returned if the function succeeds.
  • MCIERR_INVALID_DEVICE_ID The device ID is not valid.
  • MCIERR_INSTANCE_INACTIVE The device ID is inactive. Use MCI_ACQUIREDEVICE to activate.
  • MCIERR_INVALID_BUFFER The provided buffer is too small.
  • MCIERR_DEVICE_NOT_READY The device is busy or not ready.
  • MCIERR_MISSING_PARAMETER A required parameter is missing.

Remarks

The table of contents information is returned as an array of MCI_TOC_REC structures. This allows the controlling program to identify and select specific CD audio tracks for playback.

If the provided buffer is too small to hold all returned data:

  1. The error MCIERR_INVALID_BUFFER is returned.
  2. The ulBufSize field of the MCI_TOC_PARMS structure is updated with the **required** buffer size.
  3. The buffer is filled with as many records as its original size allowed.
    • Note:** Not all CD-ROM drives support this feature, even if they are capable of digital-audio playback.

Example Code

The following example illustrates how to retrieve the table of contents for the currently loaded disc.

   USHORT   usDeviceID;
   MCI_TOC_PARMS tocparms;
   #define MAXTOCRECS 30       /* Query up to 30 TOC entries           */
   MCI_TOC_REC tocrecs[MAXTOCRECS];

   /* Get the table of contents for the currently loaded disc          */

   tocparms.pBuf = tocrecs;
   tocparms.ulBufSize = sizeof(tocrecs);

   mciSendCommand(usDeviceID,  /* Device ID                            */
    MCI_GETTOC,                /* Get table of contents message        */
    MCI_WAIT,                  /* Flag for this message                */
    (PVOID) &tocparms,         /* Data structure                       */
    0);                        /* No user parm                         */

Related Messages