The following code illustrates how to get the current master volume setting.

   ULONG mastervolume;              /* Set to master volume
                                       percentage by this example      */
   BOOL  speakers_on;               /* Set to TRUE if speaker
                                       output is enabled               */
   USHORT usDeviceID;
   MCI_MASTERAUDIO_PARMS masteraudioparms;

                                    /* Get current system master
                                       volume setting                  */

   mciSendCommand(usDeviceID,       /* Device                          */
    MCI_MASTERAUDIO,                /* Master audio message            */
    MCI_WAIT | MCI_QUERYCURRENTSETTING | MCI_MASTERVOL,
                                    /* Flags for this message          */
    (PVOID) &masteraudioparms,      /* Data structure                  */
    0);                             /* User parm                       */

   mastervolume = masteraudioparms.ulReturn;


                                    /* Get current system speaker
                                       enable status                   */

   mciSendCommand(usDeviceID,       /* Device                          */
    MCI_MASTERAUDIO,                /* Master audio message            */
    MCI_WAIT | MCI_QUERYCURRENTSETTING | MCI_SPEAKERS,
    (PVOID) &masteraudioparms,       /* Flags for this message         */
    0);                              /* Data structure user parm       */
   speakers_on = masteraudioparms.ulReturn;


[Back] [Next]