BOOL SetWaveOutVolume(unsigned long dwVolume)
{
UINT uRetVal, uNumDevs;
WAVEOUTCAPS waveCaps;
uNumDevs = waveOutGetNumDevs();
if (uNumDevs<=0)
return FALSE;
if (!waveOutGetDevCaps(0,(LPWAVEOUTCAPS)&waveCaps,sizeof(WAVEOUTCAPS)))
{
// Verify the device supports volume changes
if(waveCaps.dwSupport &
WAVECAPS_VOLUME)
{
// The low word is the left volume, the high word is the right.
uRetVal = waveOutSetVolume(0, dwVolume);
if(uRetVal == MMSYSERR_NOERROR)
{ return TRUE;
}
}
}
return FALSE;
}