The following code illustrates how to determine if a device has audio capability.

   USHORT   usDeviceID;
   ULONG    rc;
   BOOL     fHas_audio;                   /* Set to TRUE by this example
                                             if device has audio      */
   MCI_GETDEVCAPS_PARMS  mgdcp;

   /* Determine if device has audio capability */

   mgdcp.ulItem = MCI_GETDEVCAPS_HAS_AUDIO;

   rc = mciSendCommand(usDeviceID,           /* Device ID              */
                       MCI_GETDEVCAPS,       /* Get device capability
                                                message                */
                       MCI_WAIT | MCI_GETDEVCAPS_ITEM,
                                             /* Flags for this message */
                       (PVOID) &mgdcp,       /* Data structure         */
                       0);                   /* No user parm           */

   if (LOUSHORT(rc) == MCIERR_SUCCESS)
     {
      fHas_audio = (BOOL) mgdcp.ulReturn; /* Return if device
                                                has audio              */
     }

The following example illustrates how an application can determine if it can set the volume attribute for a particular connector.

    ULONG  rc;
    MCI_AMP_GETDEVCAPS_PARMS mciAmpCaps;
    USHORT usDeviceID;

/* Test to see if the mixer supports volume changes on the mic. */
    mciAmpCaps.ulValue = MCI_MICROPHONE_CONNECTOR;
    mciAmpCaps.ulAttribute = MCI_AMP_CAN_SET_VOLUME;
    mciAmpCaps.ulExtended = MCI_MIXER_LINE;
    rc = mciSendCommand(usDeviceID,
                        MCI_GETDEVCAPS,
                        MCI_WAIT |
                        MCI_GETDEVCAPS_EXTENDED,
                        (ULONG)&mciAmpCaps,
                        0);


[Back] [Next]