Home > Archive > Visual Basic > November 2005 > VB5 volume control
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
VB5 volume control
|
|
|
| I use my PC soundcard for loads of things, especially with external musical
instruments. But I have a problem with other programs changing my volume
settings.
Basically, I am after a small program which will set both Volume Control and
Wave sliders to maximum without the hassle of opening the Volume Control
toolbar icon and doing it.
I am running WinXP Pro SP1.
Graham
| |
|
| Volume:
http://www.mentalis.org/vbexamples/...bexample=VOLUME
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"Grey" <grahame9@btinternet.com> wrote in message
news:dmak0c$1e6$1@newsg1.svr.pol.co.uk...
>I use my PC soundcard for loads of things, especially with external musical
> instruments. But I have a problem with other programs changing my volume
> settings.
>
> Basically, I am after a small program which will set both Volume Control
> and
> Wave sliders to maximum without the hassle of opening the Volume Control
> toolbar icon and doing it.
>
> I am running WinXP Pro SP1.
>
> Graham
>
>
| |
|
|
"Grey" <grahame9@btinternet.com> wrote in message
news:dmak0c$1e6$1@newsg1.svr.pol.co.uk...
>I use my PC soundcard for loads of things, especially with external musical
> instruments. But I have a problem with other programs changing my volume
> settings.
>
> Basically, I am after a small program which will set both Volume Control
> and
> Wave sliders to maximum without the hassle of opening the Volume Control
> toolbar icon and doing it.
And for another:
SAMPLE: Volume.exe: Set Volume Control Levels Using Visual Basic
http://support.microsoft.com/defaul...kb;en-us;178456
Another thing you might want to look at are utilities included with your
sound card. It might include something (perhaps a console app or command
line arguments for its mixer program) that you can use to easily set volume
levels, rather than having to write your own program to do it.
Unless these other programs you have that change the volume are vital (or
maybe you can find other programs that do the same thing), I think I'd ditch
them. No program should *automatically* change your volume settings. If it
does, it's a crappy program (IMO).
--
Mike
Microsoft MVP Visual Basic
| |
| Catherine Borbās 2005-11-29, 6:55 pm |
| > Volume:
> http://www.mentalis.org/vbexamples/...bexample=VOLUME
Nice one. Perhaps you'd be interested handling the other way round : reflect
in your VB volume controls, a change initiated on the central volume control
?
(or force it back to the value you want)
Public Const CALLBACK_WINDOW = &H10000
Public Const GWL_WNDPROC = -4
Public Const MM_MIXM_LINE_CHANGE = &H3D0
Public Const MM_MIXM_CONTROL_CHANGE = &H3D1
' Open mixer
RetValue = mixerOpen(hmx, 0, Me.hWnd, 0, CALLBACK_WINDOW)
....
Public Function WindowProc(ByVal hWnd As Long, ByVal wMsg As Long, ByVal
wParam As Long, ByVal lParam As Long) As Long
Dim uMixerLineControls As MIXERLINECONTROLS
Dim uMixerControl As MIXERCONTROL
Dim uDetails As MIXERCONTROLDETAILS
Dim uUnsigned As MIXERCONTROLDETAILS_UNSIGNED
Dim RetValue As Long
Dim hmem As Long
Dim i, maxWavInSources As Long
Dim MicMuted As Boolean
If wParam <> hmx Then
WindowProc = CallWindowProc(oldWndProc, hWnd, wMsg, wParam, lParam)
Else
Select Case wMsg
Case MM_MIXM_LINE_CHANGE
Debug.Print "Mixer event (line change)"
Case MM_MIXM_CONTROL_CHANGE
Debug.Print "Mixer event (control change)"
uMixerLineControls.cbmxctrl = Len(uMixerControl)
uMixerLineControls.cbStruct = Len(uMixerLineControls)
uMixerLineControls.cControls = 1
uMixerLineControls.dwControl = lParam
uMixerLineControls.dwLineID = 0
hmem = GlobalAlloc(&H40, Len(uMixerControl))
uMixerLineControls.pamxctrl = GlobalLock(hmem)
RetValue = mixerGetLineControls(hmx, uMixerLineControls,
MIXER_GETLINECONTROLSF_ONEBYID)
If RetValue <> MMSYSERR_NOERROR Then
Debug.Print "problem getting control info"
Else
CopyMemory uMixerControl, ByVal uMixerLineControls.pamxctrl,
Len(uMixerControl)
Debug.Print "Change of " + uMixerControl.szName
End If
GlobalFree hmem
hmem = 0
uDetails.cbStruct = Len(uDetails)
uDetails.item = 0
uDetails.cChannels = 1
uDetails.dwControlID = lParam
uDetails.cbDetails = Len(uBoolean)
hmem = GlobalAlloc(&H40, Len(uBoolean))
uDetails.paDetails = GlobalLock(hmem)
RetValue = mixerGetControlDetails(hmx, uDetails,
MIXER_GETCONTROLDETAILSF_VALUE)
If RetValue <> MMSYSERR_NOERROR Then
Debug.Print "problem getting control details"
Else
Debug.Print "ok"
If Left(uMixerControl.szName, 12) = "Volume micro" Then
CopyStructFromPtr uUnsigned, uDetails.paDetails,
Len(uUnsigned)
MyVBApp.MicVol.Value = uUnsigned.dwValue * 100 /
uMixerControl.lMaximum ' From zero to 100 volume slider
End If
End If
End Select
WindowProc = 0
End If
End Function
D.
|
|
|
|
|