does anybody know how to change the main sound volume of the system...
i cant find the api call.
:confused:
Printable View
does anybody know how to change the main sound volume of the system...
i cant find the api call.
:confused:
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
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?
Try This:
X is the percentage of volume, and Y is the device number.Code: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
dreamlax i cant get your snippet to work
how does it work or can u make a zip pls
thanks trav
See this link.