The following code illustrates how to obtain information about the status of a media device.
USHORT usDeviceID;
ULONG ulError;
BOOL disc_loaded;
/* Set to TRUE by this example if media is present */
MCI_STATUS_PARMS mstatusp;
mstatusp.ulItem = MCI_STATUS_MEDIA_PRESENT;
ulError = mciSendCommand(usDeviceID, /* Device ID */
MCI_STATUS, /* MCI status message */
MCI_WAIT | MCI_STATUS_ITEM,
/* Flags for this message */
(PVOID) &mstatusp, /* Data structure */
0); /* No user parm */
if (LOUSHORT(ulError) == MCIERR_SUCCESS)
{
disc_loaded = (BOOL) mstatusp.ulReturn; /* Media present
status */
}