The following code illustrates how to determine the number of waveform devices installed.
#define RETBUFSIZE 128 MCI_SYSINFO_PARMS SysInfo; CHAR SysInfoRet[RETBUFSIZE]; /* Set unused fields to zero. */ memset(&SysInfo, 0x00, sizeof(MCI_SYSINFO_PARMS)); SysInfo.usDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO; /* Device type */ SysInfo.pszReturn = (PSZ) &SysInfoRet; /* Pointer to return buffer */ SysInfo.ulRetSize = RETBUFSIZE; /* Determine the number of waveform audio devices installed */ mciSendCommand (0, /* Don't know device ID yet */ MCI_SYSINFO, /* MCI sysinfo message */ MCI_SYSINFO_QUANTITY | MCI_WAIT, /* Flags for this message */ (PVOID)&SysInfo, /* Data structure */ 0); /* No user parm */ /* SysInfoRet now contains number of wave audio devices. */