The following code illustrates how to get the file name of the currently loaded device.
#define RETBUFSIZE 128
USHORT usDeviceID;
CHAR InfoRet [RETBUFSIZE]; /* Return string buffer */
MCI_INFO_PARMS infoparms;
/* Get the file name of the currently loaded file */
infoparms.pszReturn = (PSZ) &InfoRet; /* Pointer to return buffer */
infoparms.ulRetSize = RETBUFSIZE; /* Return buffer size */
mciSendCommand(usDeviceID, /* Device ID */
MCI_INFO, /* MCI info message */
MCI_WAIT | MCI_FILE, /* Flags for this message */
(PVOID) &infoparms, /* Data structure */
0); /* No user parm */
/* NOTE: infoparms.pszReturn now contains the name
of the current file */