Speaker Volume

Do you need a registry key to do a specific task? Would you like to customize the way your PocketPC/Smartphone looks and works? This is the right place.

Moderators: Teksoft, admin

Speaker Volume

Postby sad_ghost » Tue Aug 01, 2006 1:21 pm

If you need to change speaker volume by code this might do the trick

void SetSpeakerVolumeInRegs (DWORD);
//set speaker volume in registry
void SetSpeakerVolume(int);
//set speaker volume in pannel

void SetSpeakerVolumeInRegs (DWORD param)
{
HKEY m_hKey;
DWORD dwDisposition;
DWORD i=param;
if (RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("\\ControlPanel\\Volume"),0,NULL,0,0,NULL,
&m_hKey, &dwDisposition)==ERROR_SUCCESS)
{
RegSetValueEx(m_hKey,TEXT("Volume"),0,REG_DWORD, (BYTE*)&i,sizeof(i));
RegCloseKey(m_hKey);
}
}


void SetSpeakerVolume(int param)
{
if (param==0)
{
SetSpeakerVolumeInRegs(0x0);
waveOutSetVolume(0,0x000);
}
if (param==1)
{
SetSpeakerVolumeInRegs(0x33333333);
waveOutSetVolume(0,0x4000);
}
if (param==2)
{
SetSpeakerVolumeInRegs(0x66666666);
waveOutSetVolume(0,0x6000);
}
if (param==3)
{
SetSpeakerVolumeInRegs(0x99999999);
waveOutSetVolume(0,0x8000);
}
if (param==4)
{
SetSpeakerVolumeInRegs(0xcccccccc);
waveOutSetVolume(0,0xD000);
}
if (param==5)
{
SetSpeakerVolumeInRegs(0xffffffff);
waveOutSetVolume(0,0xFFFF);
}
}
sad_ghost
TEK-Giant
TEK-Giant
 
Posts: 269
Joined: Thu Apr 06, 2006 11:04 am

Postby xhelp » Mon Dec 25, 2006 3:53 pm


sorry dear..!! i m newbi,i m not understand how to do above procedure..!!! if u don't mind plz kindly pm or reply plzzz....!!!!
thanx...!
and yes ur dam cooll guy
xhelp
TEK-Newbie
TEK-Newbie
 
Posts: 1
Joined: Mon Dec 25, 2006 3:41 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest


cron