Changing the volume programmatically 
Author Message
 Changing the volume programmatically

Can anyone tell me how to change the volume setting thru code? I have
managed to change the value of "Volume" registery in
\HKEY_CURRENT_USER\Control Panel\Volume however changing the value appears
to have no effect. I am sure this is the correct registery as thru using the
Remote Registery Editor I can see the value change correspondingly when I
change the volume manually on the device. I'm convinced there must be an API
or something which the "Settings" code in Pocket PC is calling to get the
audio hardware to take notice of the new registery setting.

Very grateful for any suggestions.

Tony



Tue, 24 Aug 2004 00:08:22 GMT  
 Changing the volume programmatically
Public Sub SetVolume()
    Dim lngReturnValue As Long

    On Error Resume Next
    'get the default volume before setting it, so we can change it back
later
    lngReturnValue = waveOutGetVolume(VOL_DEFAULT_DEVICE_HANDLE,
mlngDefaultVolume)

    ' pass in one of the constants to change the volume
    lngReturnValue = waveOutSetVolume(VOL_DEFAULT_DEVICE_HANDLE, VOL_FIVE)
End Sub

Public Sub RestoreVolume()
    Dim lngReturnValue As Long

    On Error Resume Next
    lngReturnValue = waveOutSetVolume(VOL_DEFAULT_DEVICE_HANDLE,
mlngDefaultVolume)
End Sub

' These are not API constants
Const VOL_DEFAULT_DEVICE_HANDLE = 0
Const VOL_ZERO As Long = 0
Const VOL_ONE As Long = 858993459
Const VOL_TWO As Long = 1717986918
Const VOL_THREE As Long = -1717986919
Const VOL_FOUR As Long = -85993460
Const VOL_FIVE As Long = -1

Public Declare Function waveOutGetVolume Lib "Coredll" (ByVal hwo As Long,
pdwVolume As Long) As Long
Public Declare Function waveOutSetVolume Lib "Coredll" (ByVal hwo As Long,
ByVal pdwVolume As Long) As Long


Quote:
> Can anyone tell me how to change the volume setting thru code? I have
> managed to change the value of "Volume" registery in
> \HKEY_CURRENT_USER\Control Panel\Volume however changing the value appears
> to have no effect. I am sure this is the correct registery as thru using
the
> Remote Registery Editor I can see the value change correspondingly when I
> change the volume manually on the device. I'm convinced there must be an
API
> or something which the "Settings" code in Pocket PC is calling to get the
> audio hardware to take notice of the new registery setting.

> Very grateful for any suggestions.

> Tony



Tue, 24 Aug 2004 00:29:36 GMT  
 Changing the volume programmatically
Dave

Brilliant!

Many thanks.

Tony


Quote:
> Public Sub SetVolume()
>     Dim lngReturnValue As Long

>     On Error Resume Next
>     'get the default volume before setting it, so we can change it back
> later
>     lngReturnValue = waveOutGetVolume(VOL_DEFAULT_DEVICE_HANDLE,
> mlngDefaultVolume)

>     ' pass in one of the constants to change the volume
>     lngReturnValue = waveOutSetVolume(VOL_DEFAULT_DEVICE_HANDLE, VOL_FIVE)
> End Sub

> Public Sub RestoreVolume()
>     Dim lngReturnValue As Long

>     On Error Resume Next
>     lngReturnValue = waveOutSetVolume(VOL_DEFAULT_DEVICE_HANDLE,
> mlngDefaultVolume)
> End Sub

> ' These are not API constants
> Const VOL_DEFAULT_DEVICE_HANDLE = 0
> Const VOL_ZERO As Long = 0
> Const VOL_ONE As Long = 858993459
> Const VOL_TWO As Long = 1717986918
> Const VOL_THREE As Long = -1717986919
> Const VOL_FOUR As Long = -85993460
> Const VOL_FIVE As Long = -1

> Public Declare Function waveOutGetVolume Lib "Coredll" (ByVal hwo As Long,
> pdwVolume As Long) As Long
> Public Declare Function waveOutSetVolume Lib "Coredll" (ByVal hwo As Long,
> ByVal pdwVolume As Long) As Long



> > Can anyone tell me how to change the volume setting thru code? I have
> > managed to change the value of "Volume" registery in
> > \HKEY_CURRENT_USER\Control Panel\Volume however changing the value
appears
> > to have no effect. I am sure this is the correct registery as thru using
> the
> > Remote Registery Editor I can see the value change correspondingly when
I
> > change the volume manually on the device. I'm convinced there must be an
> API
> > or something which the "Settings" code in Pocket PC is calling to get
the
> > audio hardware to take notice of the new registery setting.

> > Very grateful for any suggestions.

> > Tony



Tue, 24 Aug 2004 03:54:39 GMT  
 Changing the volume programmatically
you could always try MultiMediaThingo from www.thingo.co.nz
as far as i know its FREE
and it provides all sorts of useful features such as
    changing the system volume
    playing sound files and system events
    returning information on the sound system

--

wolf kumpitsch
snr design engineer, thingo ltd

http://www.thingo.co.nz

------------------------- we make things, useful -------------------------


Quote:
> Can anyone tell me how to change the volume setting thru code? I have
> managed to change the value of "Volume" registery in
> \HKEY_CURRENT_USER\Control Panel\Volume however changing the value appears
> to have no effect. I am sure this is the correct registery as thru using
the
> Remote Registery Editor I can see the value change correspondingly when I
> change the volume manually on the device. I'm convinced there must be an
API
> or something which the "Settings" code in Pocket PC is calling to get the
> audio hardware to take notice of the new registery setting.

> Very grateful for any suggestions.

> Tony



Tue, 02 Nov 2004 04:59:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Control CD-ROM volume programmatically?

2. Change the Volume Label of a Disk

3. Volume change in SB

4. Working with slidercontrol ( changing volume etc... )

5. How to change volume?

6. How can I change the volume of my soundcard

7. Changing wave volume under VB

8. Change the Volume

9. HOW TO change the volume serial number

10. How to change sys volume by code?

11. Changing the playback volume of WAV files

12. Changing The Volume of a .wav File In VB 5.0

 

 
Powered by phpBB® Forum Software