The following code illustrates how to get a table of contents structure for the currently loaded device.
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 */