PDA

Click to See Complete Forum and Search --> : System Volume


Tal Zur
Jun 5th, 2001, 09:16 PM
does anybody know how to change the main sound volume of the system...
i cant find the api call.
:confused:

Innofin
Jun 8th, 2001, 09:44 AM
Declare Function auxSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long

This example will set the volume of auxiliary audio device 0 to 50%.

Dim retval As Long

' Set the volume of both channels (if a second exists) to 50%
retval = auxSetVolume(0, &H80008000) ' both words are set

Wak
Jun 9th, 2001, 06:59 PM
I realized that it hold the value of a long to 64000.... and then it wraps around, but how come sometimes it centers it to the left speakers and other times to the right speaker?? This is if I just use a long variable in the function?? Any ideas?

Dreamlax
Jun 12th, 2001, 04:47 AM
Try This:


Dim lngSetVolTo As Long
Dim strTemp As String
lngSetVolTo = X / 100 * 65536
strTemp = Hex(lngSetVolTo + 65536)
If strTemp <> "20000" Then
strTemp = Right(strTemp, 4)
lngSetVolTo = CLng("&H" & strTemp & strTemp)
auxSetVolume Y, lngSetVolTo
Else
auxSetVolume Y, -1
End If


X is the percentage of volume, and Y is the device number.

Trav
Jun 1st, 2002, 11:02 PM
dreamlax i cant get your snippet to work

how does it work or can u make a zip pls

thanks trav

Megatron
Jun 2nd, 2002, 10:56 AM
See this link (http://www.vbforums.com/showthread.php?s=&threadid=18403).