Главная страница | назад

Article #17637: How to set wave volume

 Question and Answer Database

FAQ2637C.txt   How to set wave volume
Category   :Windows API
Platform    :All
Product    :C++Builder  3.x

How do I set the volume of my TMediaPlayer to something 
other than what the system has it at?

Use the WinAPI MultiMedia fucntions:

unsigned long OldVolume, NewVolume;

waveOutGetVolume(0, (LPDWORD) &OldVolume); // to store the data

NewVolume = REALLY_LOUD;

waveOutSetVolume(0, (DWORD) NewVolume);   // set volume volumne to something else

// Do stuff

waveOutSetVolume(0, (DWORD) OldVolume);

You will need to store the value of the original volume 
using the first function and set it back to the OldVolume 
when you are done.

7/2/98 10:32:32 AM

Last Modified: 02-FEB-00