473,473 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

master volume control in winmm using namespaces

Ok I am not a programmer, I copied some code and very painfully got it
working in VB6. I can adjust the volume with waveOutSetVolume on winmm.dll.
But I could not seem to be able to figure out how to adjust the master
volume. I thought maybe if I upgraded this into VS2005 VB.Net then it might
be a little easier. But now I am getting PInvokeStackImbalance messages on
this, and it doesn't even run. We're talking a very little program... A
programmer-friend of mine told me this might be related to me calling dlls
instead of using namespaces, he thinks
something.computer.soundcard.volume.set or some such thing. My experience
is vbScript so I am lost - I read you can't do this in vbScript, there are
lots of questions out there about how do you control the master volume, lots
of answers that dodge that question... anyone want to take a stab at fixing
this, or pointing me to a good help-myself point? I do have MSDN Library
but I have not made it through the whole DVD yet :op I'm not sure what to
even search for. I suspect there is something like waveOutSetVolume but not
starting with wave....

Anyway first is the VB.Net conversion (this is all in the form code),
complete with errors, then is the vb6 code that works - type in a percent
and it sets the wave volume.

TIA if anyone wants to take a stab at it...

--
Rich Milburn
[MVP - Directory Services]

'----------------vbNet code-----------------------------
' This gets several errors from the conversion from vb6, most of it is
copied and modified from vb6 (I think) examples

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Short, ByVal dwVolume As Integer) As Short
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Short, ByRef lpdwVolume As Integer) As Short

Const SND_ASYNC As Short = &H1s
Const SND_NODEFAULT As Short = &H2s

Dim CurrentVolLeft As Integer
Dim CurrentVolRight As Integer

Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles SetMaxVol.Click
Dim x As Short
Dim a As Object
Dim i As Integer
Dim tmp As Object
Dim vol As String
vol = CStr(CDbl(Text1.Text) / 100 * 65535)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click for
more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click for
more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
vol = CStr(CInt("&H" & tmp & tmp))
'UPGRADE_WARNING: Couldn't resolve default property of object a. Click for
more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
a = waveOutSetVolume(0, CInt(vol))

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub

Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdRefresh.Click
Dim x As Short
Dim BothVolumes As Integer
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF

CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And &HFFFF
LeftVol.Text = Hex(CurrentVolLeft)
RightVol.Text = Hex(CurrentVolRight)
tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
Text1.Text = CStr((CInt(tmp) / 65535) * 100)

End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles MyBase.Load
cmdRefresh_Click(cmdRefresh, New System.EventArgs())
End Sub
End Class
'------------------ end vbNet code--------------------------
'vb6 code -----------------------------------------------
'this works for wave volume, but could not figure out master volume
Option Explicit
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, lpdwVolume As Long) As Integer
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Dim CurrentVolLeft As Long
Dim CurrentVolRight As Long
Private Sub SetMaxVol_Click()
Dim x As Integer
Dim a, i As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub
Private Sub cmdRefresh_Click()
Dim x As Integer
Dim BothVolumes As Long
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF&

CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And &HFFFF&
LeftVol.Caption = Hex$(CurrentVolLeft)
RightVol.Caption = Hex$(CurrentVolRight)
tmp = "&h" & Right(Hex$(BothVolumes), 4)
Text1 = (CLng(tmp) / 65535) * 100
End Sub

Private Sub Form_Load()
cmdRefresh_Click
End Sub
'--------------------- end vb6
code -----------------------------------------------
Feb 9 '06 #1
7 7625
I managed to write a class to control Wave, Master, CD player, Line In and
Microphone volumes in the windows mixer many years ago.
It was in VB6, and took me several months of research to build it all! I
upgraded it to VB2003 a few years ago, but I don't think I ever got it
working like it used to.
This article is the most useful one I've found so far - it's C#, but I find
that easier to translate to VB.NET than VB6 sometimes!
http://www.codeproject.com/useritems/AudioLib.asp

As for your code below, here's a few pointers;
a) Change your As Short declarations to As Integer (a Long in VB6 translates
to a Short in .NET, you want an Integer (32 bits))
b) Dim 'tmp' as a string, and 'a' as integer, not objects. That clears off
the first 3 upgrade warnings.
c) Switch Option Strict On - it's there to help - not just fill up the task
list/error list!!

This is the MSDN entry for WaveOutSetVolume. I'm suprised you couldn't find
it in your local MSDN(??).
http://msdn.microsoft.com/library/de...tsetvolume.asp
Start there, and go through each of the "See Also" items to get your head
round how the API call works.

This post sets the WaveOutVolume to 0. Note the different API declaration
to your "old" method.
http://forums.microsoft.com/MSDN/Sho...78167&SiteId=1

Hope that gets you started.
__________________________________________________ ___
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Ok I am not a programmer, I copied some code and very painfully got it
working in VB6. I can adjust the volume with waveOutSetVolume on
winmm.dll. But I could not seem to be able to figure out how to adjust the
master volume. I thought maybe if I upgraded this into VS2005 VB.Net then
it might be a little easier. But now I am getting PInvokeStackImbalance
messages on this, and it doesn't even run. We're talking a very little
program... A programmer-friend of mine told me this might be related to me
calling dlls instead of using namespaces, he thinks
something.computer.soundcard.volume.set or some such thing. My experience
is vbScript so I am lost - I read you can't do this in vbScript, there are
lots of questions out there about how do you control the master volume,
lots of answers that dodge that question... anyone want to take a stab at
fixing this, or pointing me to a good help-myself point? I do have MSDN
Library but I have not made it through the whole DVD yet :op I'm not sure
what to even search for. I suspect there is something like
waveOutSetVolume but not starting with wave....

Anyway first is the VB.Net conversion (this is all in the form code),
complete with errors, then is the vb6 code that works - type in a percent
and it sets the wave volume.

TIA if anyone wants to take a stab at it...

--
Rich Milburn
[MVP - Directory Services]

'----------------vbNet code-----------------------------
' This gets several errors from the conversion from vb6, most of it is
copied and modified from vb6 (I think) examples

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Short, ByVal dwVolume As Integer) As Short
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Short, ByRef lpdwVolume As Integer) As Short

Const SND_ASYNC As Short = &H1s
Const SND_NODEFAULT As Short = &H2s

Dim CurrentVolLeft As Integer
Dim CurrentVolRight As Integer

Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles SetMaxVol.Click
Dim x As Short
Dim a As Object
Dim i As Integer
Dim tmp As Object
Dim vol As String
vol = CStr(CDbl(Text1.Text) / 100 * 65535)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
vol = CStr(CInt("&H" & tmp & tmp))
'UPGRADE_WARNING: Couldn't resolve default property of object a. Click for
more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
a = waveOutSetVolume(0, CInt(vol))

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub

Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdRefresh.Click
Dim x As Short
Dim BothVolumes As Integer
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF

CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF
LeftVol.Text = Hex(CurrentVolLeft)
RightVol.Text = Hex(CurrentVolRight)
tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
Text1.Text = CStr((CInt(tmp) / 65535) * 100)

End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles MyBase.Load
cmdRefresh_Click(cmdRefresh, New System.EventArgs())
End Sub
End Class
'------------------ end vbNet code--------------------------
'vb6 code -----------------------------------------------
'this works for wave volume, but could not figure out master volume
Option Explicit
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, lpdwVolume As Long) As Integer
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Dim CurrentVolLeft As Long
Dim CurrentVolRight As Long
Private Sub SetMaxVol_Click()
Dim x As Integer
Dim a, i As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub
Private Sub cmdRefresh_Click()
Dim x As Integer
Dim BothVolumes As Long
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF&

CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And &HFFFF&
LeftVol.Caption = Hex$(CurrentVolLeft)
RightVol.Caption = Hex$(CurrentVolRight)
tmp = "&h" & Right(Hex$(BothVolumes), 4)
Text1 = (CLng(tmp) / 65535) * 100
End Sub

Private Sub Form_Load()
cmdRefresh_Click
End Sub
'--------------------- end vb6
code -----------------------------------------------

Feb 9 '06 #2
Rich,

I am not a sound guy or whatever multimedia, however I would ask it as well
in one of the newsgroup

microsoft.public.directX*.

Not to sent you away here of course as some people see this kind of
messages.

Be aware that DirectX is very bad documented to use in combination with
VBNet and bad for C# all is still C++ it is a little bit looking in the past
using that.

I have tried some things with it, and saw things as you are asking for.

Cor
Feb 10 '06 #3
Thank you very much! I'll get started on that right away! :)

--
Rich Milburn
[MVP - Directory Services]
"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I managed to write a class to control Wave, Master, CD player, Line In and
Microphone volumes in the windows mixer many years ago.
It was in VB6, and took me several months of research to build it all! I
upgraded it to VB2003 a few years ago, but I don't think I ever got it
working like it used to.
This article is the most useful one I've found so far - it's C#, but I
find that easier to translate to VB.NET than VB6 sometimes!
http://www.codeproject.com/useritems/AudioLib.asp

As for your code below, here's a few pointers;
a) Change your As Short declarations to As Integer (a Long in VB6
translates to a Short in .NET, you want an Integer (32 bits))
b) Dim 'tmp' as a string, and 'a' as integer, not objects. That clears
off the first 3 upgrade warnings.
c) Switch Option Strict On - it's there to help - not just fill up the
task list/error list!!

This is the MSDN entry for WaveOutSetVolume. I'm suprised you couldn't
find it in your local MSDN(??).
http://msdn.microsoft.com/library/de...tsetvolume.asp
Start there, and go through each of the "See Also" items to get your head
round how the API call works.

This post sets the WaveOutVolume to 0. Note the different API declaration
to your "old" method.
http://forums.microsoft.com/MSDN/Sho...78167&SiteId=1

Hope that gets you started.
__________________________________________________ ___
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Ok I am not a programmer, I copied some code and very painfully got it
working in VB6. I can adjust the volume with waveOutSetVolume on
winmm.dll. But I could not seem to be able to figure out how to adjust
the master volume. I thought maybe if I upgraded this into VS2005 VB.Net
then it might be a little easier. But now I am getting
PInvokeStackImbalance messages on this, and it doesn't even run. We're
talking a very little program... A programmer-friend of mine told me this
might be related to me calling dlls instead of using namespaces, he
thinks something.computer.soundcard.volume.set or some such thing. My
experience is vbScript so I am lost - I read you can't do this in
vbScript, there are lots of questions out there about how do you control
the master volume, lots of answers that dodge that question... anyone
want to take a stab at fixing this, or pointing me to a good help-myself
point? I do have MSDN Library but I have not made it through the whole
DVD yet :op I'm not sure what to even search for. I suspect there is
something like waveOutSetVolume but not starting with wave....

Anyway first is the VB.Net conversion (this is all in the form code),
complete with errors, then is the vb6 code that works - type in a percent
and it sets the wave volume.

TIA if anyone wants to take a stab at it...

--
Rich Milburn
[MVP - Directory Services]

'----------------vbNet code-----------------------------
' This gets several errors from the conversion from vb6, most of it is
copied and modified from vb6 (I think) examples

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByVal dwVolume As Integer) As Short
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByRef lpdwVolume As Integer) As Short

Const SND_ASYNC As Short = &H1s
Const SND_NODEFAULT As Short = &H2s

Dim CurrentVolLeft As Integer
Dim CurrentVolRight As Integer

Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles SetMaxVol.Click
Dim x As Short
Dim a As Object
Dim i As Integer
Dim tmp As Object
Dim vol As String
vol = CStr(CDbl(Text1.Text) / 100 * 65535)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
vol = CStr(CInt("&H" & tmp & tmp))
'UPGRADE_WARNING: Couldn't resolve default property of object a. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
a = waveOutSetVolume(0, CInt(vol))

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub

Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdRefresh.Click
Dim x As Short
Dim BothVolumes As Integer
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF

CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF
LeftVol.Text = Hex(CurrentVolLeft)
RightVol.Text = Hex(CurrentVolRight)
tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
Text1.Text = CStr((CInt(tmp) / 65535) * 100)

End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles MyBase.Load
cmdRefresh_Click(cmdRefresh, New System.EventArgs())
End Sub
End Class
'------------------ end vbNet code--------------------------
'vb6 code -----------------------------------------------
'this works for wave volume, but could not figure out master volume
Option Explicit
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, lpdwVolume As Long) As Integer
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Dim CurrentVolLeft As Long
Dim CurrentVolRight As Long
Private Sub SetMaxVol_Click()
Dim x As Integer
Dim a, i As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub
Private Sub cmdRefresh_Click()
Dim x As Integer
Dim BothVolumes As Long
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF&

CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And &HFFFF&
LeftVol.Caption = Hex$(CurrentVolLeft)
RightVol.Caption = Hex$(CurrentVolRight)
tmp = "&h" & Right(Hex$(BothVolumes), 4)
Text1 = (CLng(tmp) / 65535) * 100
End Sub

Private Sub Form_Load()
cmdRefresh_Click
End Sub
'--------------------- end vb6
code -----------------------------------------------


Feb 10 '06 #4
I downloaded the source code you referred to, and tried to wade through
it... it sure does a lot of stuff... I did indeed already find the MSDN link
on waveOutSetVolume, and I have indeed gotten that one working. What I
could not figure out is what is the comparable API for MasterOutSetVolume -
not that it is called that, it's not - if it was, I wouldn't have to ask :)
I did post this to directx.audio also, but that group is pretty slow...

I cut my vb6 code down to:

Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, ByVal dwVolume As Long) As Integer

Private Sub SetVol_Click()
Dim a As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub

any ideas what the master volume set function is called, or how I can find
out? Did you figure that out in VB6?
thanks again -
Rich
--
Rich Milburn
[MVP - Directory Services]

"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I managed to write a class to control Wave, Master, CD player, Line In and
Microphone volumes in the windows mixer many years ago.
It was in VB6, and took me several months of research to build it all! I
upgraded it to VB2003 a few years ago, but I don't think I ever got it
working like it used to.
This article is the most useful one I've found so far - it's C#, but I
find that easier to translate to VB.NET than VB6 sometimes!
http://www.codeproject.com/useritems/AudioLib.asp

As for your code below, here's a few pointers;
a) Change your As Short declarations to As Integer (a Long in VB6
translates to a Short in .NET, you want an Integer (32 bits))
b) Dim 'tmp' as a string, and 'a' as integer, not objects. That clears
off the first 3 upgrade warnings.
c) Switch Option Strict On - it's there to help - not just fill up the
task list/error list!!

This is the MSDN entry for WaveOutSetVolume. I'm suprised you couldn't
find it in your local MSDN(??).
http://msdn.microsoft.com/library/de...tsetvolume.asp
Start there, and go through each of the "See Also" items to get your head
round how the API call works.

This post sets the WaveOutVolume to 0. Note the different API declaration
to your "old" method.
http://forums.microsoft.com/MSDN/Sho...78167&SiteId=1

Hope that gets you started.
__________________________________________________ ___
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Ok I am not a programmer, I copied some code and very painfully got it
working in VB6. I can adjust the volume with waveOutSetVolume on
winmm.dll. But I could not seem to be able to figure out how to adjust
the master volume. I thought maybe if I upgraded this into VS2005 VB.Net
then it might be a little easier. But now I am getting
PInvokeStackImbalance messages on this, and it doesn't even run. We're
talking a very little program... A programmer-friend of mine told me this
might be related to me calling dlls instead of using namespaces, he
thinks something.computer.soundcard.volume.set or some such thing. My
experience is vbScript so I am lost - I read you can't do this in
vbScript, there are lots of questions out there about how do you control
the master volume, lots of answers that dodge that question... anyone
want to take a stab at fixing this, or pointing me to a good help-myself
point? I do have MSDN Library but I have not made it through the whole
DVD yet :op I'm not sure what to even search for. I suspect there is
something like waveOutSetVolume but not starting with wave....

Anyway first is the VB.Net conversion (this is all in the form code),
complete with errors, then is the vb6 code that works - type in a percent
and it sets the wave volume.

TIA if anyone wants to take a stab at it...

--
Rich Milburn
[MVP - Directory Services]

'----------------vbNet code-----------------------------
' This gets several errors from the conversion from vb6, most of it is
copied and modified from vb6 (I think) examples

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByVal dwVolume As Integer) As Short
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByRef lpdwVolume As Integer) As Short

Const SND_ASYNC As Short = &H1s
Const SND_NODEFAULT As Short = &H2s

Dim CurrentVolLeft As Integer
Dim CurrentVolRight As Integer

Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles SetMaxVol.Click
Dim x As Short
Dim a As Object
Dim i As Integer
Dim tmp As Object
Dim vol As String
vol = CStr(CDbl(Text1.Text) / 100 * 65535)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
vol = CStr(CInt("&H" & tmp & tmp))
'UPGRADE_WARNING: Couldn't resolve default property of object a. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
a = waveOutSetVolume(0, CInt(vol))

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub

Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdRefresh.Click
Dim x As Short
Dim BothVolumes As Integer
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF

CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF
LeftVol.Text = Hex(CurrentVolLeft)
RightVol.Text = Hex(CurrentVolRight)
tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
Text1.Text = CStr((CInt(tmp) / 65535) * 100)

End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles MyBase.Load
cmdRefresh_Click(cmdRefresh, New System.EventArgs())
End Sub
End Class
'------------------ end vbNet code--------------------------
'vb6 code -----------------------------------------------
'this works for wave volume, but could not figure out master volume
Option Explicit
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, lpdwVolume As Long) As Integer
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Dim CurrentVolLeft As Long
Dim CurrentVolRight As Long
Private Sub SetMaxVol_Click()
Dim x As Integer
Dim a, i As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub
Private Sub cmdRefresh_Click()
Dim x As Integer
Dim BothVolumes As Long
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF&

CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And &HFFFF&
LeftVol.Caption = Hex$(CurrentVolLeft)
RightVol.Caption = Hex$(CurrentVolRight)
tmp = "&h" & Right(Hex$(BothVolumes), 4)
Text1 = (CLng(tmp) / 65535) * 100
End Sub

Private Sub Form_Load()
cmdRefresh_Click
End Sub
'--------------------- end vb6
code -----------------------------------------------


Feb 10 '06 #5
Right.. after over 10 minutes of digging through my 500 gig hard drive....
lol... found my old code!
I used the MixerLine and Mixer structures and some different APIs to the
WaveOutSetVolume thingy.
A quick search on MSDN found the link below, which is a bit clearer than my
old code!

http://www.devx.com/vb2themax/Tip/19...ticle&trk=MSCP

Hope that helps get your master volume under control!
______________________________________________
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:uL*************@tk2msftngp13.phx.gbl...
I downloaded the source code you referred to, and tried to wade through
it... it sure does a lot of stuff... I did indeed already find the MSDN
link on waveOutSetVolume, and I have indeed gotten that one working. What
I could not figure out is what is the comparable API for
MasterOutSetVolume - not that it is called that, it's not - if it was, I
wouldn't have to ask :)
I did post this to directx.audio also, but that group is pretty slow...

I cut my vb6 code down to:

Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, ByVal dwVolume As Long) As Integer

Private Sub SetVol_Click()
Dim a As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub

any ideas what the master volume set function is called, or how I can find
out? Did you figure that out in VB6?
thanks again -
Rich
--
Rich Milburn
[MVP - Directory Services]

"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I managed to write a class to control Wave, Master, CD player, Line In and
Microphone volumes in the windows mixer many years ago.
It was in VB6, and took me several months of research to build it all! I
upgraded it to VB2003 a few years ago, but I don't think I ever got it
working like it used to.
This article is the most useful one I've found so far - it's C#, but I
find that easier to translate to VB.NET than VB6 sometimes!
http://www.codeproject.com/useritems/AudioLib.asp

As for your code below, here's a few pointers;
a) Change your As Short declarations to As Integer (a Long in VB6
translates to a Short in .NET, you want an Integer (32 bits))
b) Dim 'tmp' as a string, and 'a' as integer, not objects. That clears
off the first 3 upgrade warnings.
c) Switch Option Strict On - it's there to help - not just fill up the
task list/error list!!

This is the MSDN entry for WaveOutSetVolume. I'm suprised you couldn't
find it in your local MSDN(??).
http://msdn.microsoft.com/library/de...tsetvolume.asp
Start there, and go through each of the "See Also" items to get your head
round how the API call works.

This post sets the WaveOutVolume to 0. Note the different API
declaration to your "old" method.
http://forums.microsoft.com/MSDN/Sho...78167&SiteId=1

Hope that gets you started.
__________________________________________________ ___
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Ok I am not a programmer, I copied some code and very painfully got it
working in VB6. I can adjust the volume with waveOutSetVolume on
winmm.dll. But I could not seem to be able to figure out how to adjust
the master volume. I thought maybe if I upgraded this into VS2005
VB.Net then it might be a little easier. But now I am getting
PInvokeStackImbalance messages on this, and it doesn't even run. We're
talking a very little program... A programmer-friend of mine told me
this might be related to me calling dlls instead of using namespaces, he
thinks something.computer.soundcard.volume.set or some such thing. My
experience is vbScript so I am lost - I read you can't do this in
vbScript, there are lots of questions out there about how do you control
the master volume, lots of answers that dodge that question... anyone
want to take a stab at fixing this, or pointing me to a good help-myself
point? I do have MSDN Library but I have not made it through the whole
DVD yet :op I'm not sure what to even search for. I suspect there is
something like waveOutSetVolume but not starting with wave....

Anyway first is the VB.Net conversion (this is all in the form code),
complete with errors, then is the vb6 code that works - type in a
percent and it sets the wave volume.

TIA if anyone wants to take a stab at it...

--
Rich Milburn
[MVP - Directory Services]

'----------------vbNet code-----------------------------
' This gets several errors from the conversion from vb6, most of it is
copied and modified from vb6 (I think) examples

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByVal dwVolume As Integer) As Short
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByRef lpdwVolume As Integer) As Short

Const SND_ASYNC As Short = &H1s
Const SND_NODEFAULT As Short = &H2s

Dim CurrentVolLeft As Integer
Dim CurrentVolRight As Integer

Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles SetMaxVol.Click
Dim x As Short
Dim a As Object
Dim i As Integer
Dim tmp As Object
Dim vol As String
vol = CStr(CDbl(Text1.Text) / 100 * 65535)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
vol = CStr(CInt("&H" & tmp & tmp))
'UPGRADE_WARNING: Couldn't resolve default property of object a. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
a = waveOutSetVolume(0, CInt(vol))

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub

Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdRefresh.Click
Dim x As Short
Dim BothVolumes As Integer
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF

CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF
LeftVol.Text = Hex(CurrentVolLeft)
RightVol.Text = Hex(CurrentVolRight)
tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
Text1.Text = CStr((CInt(tmp) / 65535) * 100)

End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles MyBase.Load
cmdRefresh_Click(cmdRefresh, New System.EventArgs())
End Sub
End Class
'------------------ end vbNet code--------------------------
'vb6 code -----------------------------------------------
'this works for wave volume, but could not figure out master volume
Option Explicit
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, lpdwVolume As Long) As Integer
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Dim CurrentVolLeft As Long
Dim CurrentVolRight As Long
Private Sub SetMaxVol_Click()
Dim x As Integer
Dim a, i As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub
Private Sub cmdRefresh_Click()
Dim x As Integer
Dim BothVolumes As Long
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF&

CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF&
LeftVol.Caption = Hex$(CurrentVolLeft)
RightVol.Caption = Hex$(CurrentVolRight)
tmp = "&h" & Right(Hex$(BothVolumes), 4)
Text1 = (CLng(tmp) / 65535) * 100
End Sub

Private Sub Form_Load()
cmdRefresh_Click
End Sub
'--------------------- end vb6
code -----------------------------------------------



Feb 10 '06 #6
You Rock! it works great! I'll post the code here in case anyone is
interested. I have a command button called SetVol, and a text box called
Text1. Enter the percentage in the box and it sets both the master and wave
vol levels together.
it's mostly from that code at devx...
Rich

--
Rich Milburn
[MVP - Directory Services]

Const MMSYSERR_NOERROR = 0
Const MAXPNAMELEN = 32
Const MIXER_LONG_NAME_CHARS = 64
Const MIXER_SHORT_NAME_CHARS = 16
Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = &H4
Const MIXERCONTROL_CONTROLTYPE_VOLUME = &H50030001

Private Declare Function mixerOpen Lib "WINMM.DLL" (phmx As Long, _
ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long,
_
ByVal fdwOpen As Long) As Long
Private Declare Function mixerGetLineInfo Lib "WINMM.DLL" Alias _
"mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, _
ByVal fdwInfo As Long) As Long
Private Declare Function mixerGetLineControls Lib "WINMM.DLL" Alias _
"mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As
MIXERLINECONTROLS, _
ByVal fdwControls As Long) As Long
Private Declare Function mixerSetControlDetails Lib "WINMM.DLL" (ByVal
hmxobj _
As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Private Declare Function mixerClose Lib "WINMM.DLL" (ByVal hmx As Long) As
Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, _
ByVal dwBytes As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hmem As Long) As
Long
Private Declare Function GlobalFree Lib "kernel32" (ByVal hmem As Long) As
Long
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, ByVal dwVolume As Long) As Integer
Private Type MIXERCONTROL
cbStruct As Long
dwControlID As Long
dwControlType As Long
fdwControl As Long
cMultipleItems As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
lMinimum As Long
lMaximum As Long
reserved(10) As Long
End Type

Private Type MIXERCONTROLDETAILS
cbStruct As Long
dwControlID As Long
cChannels As Long
item As Long
cbDetails As Long
paDetails As Long
End Type

Private Type MIXERCONTROLDETAILS_UNSIGNED
dwValue As Long
End Type

Private Type MIXERLINE
cbStruct As Long
dwDestination As Long
dwSource As Long
dwLineID As Long
fdwLine As Long
dwUser As Long
dwComponentType As Long
cChannels As Long
cConnections As Long
cControls As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
dwType As Long
dwDeviceID As Long
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
End Type

Private Type MIXERLINECONTROLS
cbStruct As Long
dwLineID As Long
dwControl As Long
cControls As Long
cbmxctrl As Long
pamxctrl As Long
End Type

' Set the master volume level.
'
' VolumeLevel is the level value in percentage (0 = min, 100 = max)
' Returns True if successful

Function SetVolume(VolumeLevel As Long) As Boolean
Dim hmx As Long
Dim uMixerLine As MIXERLINE
Dim uMixerControl As MIXERCONTROL
Dim uMixerLineControls As MIXERLINECONTROLS
Dim uDetails As MIXERCONTROLDETAILS
Dim uUnsigned As MIXERCONTROLDETAILS_UNSIGNED
Dim RetValue As Long
Dim hmem As Long

' VolumeLevel value must be between 0 and 100
If VolumeLevel < 0 Or VolumeLevel > 100 Then GoTo error

' Open the mixer
RetValue = mixerOpen(hmx, 0, 0, 0, 0)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Initialize MIXERLINE structure and call mixerGetLineInfo
uMixerLine.cbStruct = Len(uMixerLine)
uMixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
RetValue = mixerGetLineInfo(hmx, uMixerLine, _
MIXER_GETLINEINFOF_COMPONENTTYPE)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Initialize MIXERLINECONTROLS strucure and
' call mixerGetLineControls
uMixerLineControls.cbStruct = Len(uMixerLineControls)
uMixerLineControls.dwLineID = uMixerLine.dwLineID
uMixerLineControls.dwControl = MIXERCONTROL_CONTROLTYPE_VOLUME
uMixerLineControls.cControls = 1
uMixerLineControls.cbmxctrl = Len(uMixerControl)

' Allocate a buffer to receive the properties of the master volume
control
' and put his address into uMixerLineControls.pamxctrl
hmem = GlobalAlloc(&H40, Len(uMixerControl))
uMixerLineControls.pamxctrl = GlobalLock(hmem)
uMixerControl.cbStruct = Len(uMixerControl)
RetValue = mixerGetLineControls(hmx, uMixerLineControls, _
MIXER_GETLINECONTROLSF_ONEBYTYPE)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Copy data buffer into the uMixerControl structure
CopyMemory uMixerControl, ByVal uMixerLineControls.pamxctrl, _
Len(uMixerControl)
GlobalFree hmem
hmem = 0

uDetails.item = 0
uDetails.dwControlID = uMixerControl.dwControlID
uDetails.cbStruct = Len(uDetails)
uDetails.cbDetails = Len(uUnsigned)

' Allocate a buffer in which properties for the volume control are set
' and put his address into uDetails.paDetails
hmem = GlobalAlloc(&H40, Len(uUnsigned))
uDetails.paDetails = GlobalLock(hmem)
uDetails.cChannels = 1
uUnsigned.dwValue = CLng((VolumeLevel * uMixerControl.lMaximum) / 100)
CopyMemory ByVal uDetails.paDetails, uUnsigned, Len(uUnsigned)

' Set new volume level
RetValue = mixerSetControlDetails(hmx, uDetails, _
MIXER_SETCONTROLDETAILSF_VALUE)
GlobalFree hmem
hmem = 0
If RetValue <> MMSYSERR_NOERROR Then GoTo error

mixerClose hmx
' signal success
SetVolume = True
Exit Function

error:
' An error occurred

' Release resources
If hmx <> 0 Then mixerClose hmx
If hmem Then GlobalFree hmem
' signal failure
SetVolume = False

End Function

Private Sub SetWaveVol(VolumeLevel As Long)
Dim a As Long
Dim tmp, vol As String
vol = VolumeLevel / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub

Private Sub SetVol_Click()
SetVolume (Text1.Text)
SetWaveVol (Text1.Text)
End Sub

"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Right.. after over 10 minutes of digging through my 500 gig hard drive....
lol... found my old code!
I used the MixerLine and Mixer structures and some different APIs to the
WaveOutSetVolume thingy.
A quick search on MSDN found the link below, which is a bit clearer than
my old code!

http://www.devx.com/vb2themax/Tip/19...ticle&trk=MSCP

Hope that helps get your master volume under control!
______________________________________________
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:uL*************@tk2msftngp13.phx.gbl...
I downloaded the source code you referred to, and tried to wade through
it... it sure does a lot of stuff... I did indeed already find the MSDN
link on waveOutSetVolume, and I have indeed gotten that one working. What
I could not figure out is what is the comparable API for
MasterOutSetVolume - not that it is called that, it's not - if it was, I
wouldn't have to ask :)
I did post this to directx.audio also, but that group is pretty slow...

I cut my vb6 code down to:

Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID
As Integer, ByVal dwVolume As Long) As Integer

Private Sub SetVol_Click()
Dim a As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub

any ideas what the master volume set function is called, or how I can
find out? Did you figure that out in VB6?
thanks again -
Rich
--
Rich Milburn
[MVP - Directory Services]

"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I managed to write a class to control Wave, Master, CD player, Line In
and Microphone volumes in the windows mixer many years ago.
It was in VB6, and took me several months of research to build it all!
I upgraded it to VB2003 a few years ago, but I don't think I ever got it
working like it used to.
This article is the most useful one I've found so far - it's C#, but I
find that easier to translate to VB.NET than VB6 sometimes!
http://www.codeproject.com/useritems/AudioLib.asp

As for your code below, here's a few pointers;
a) Change your As Short declarations to As Integer (a Long in VB6
translates to a Short in .NET, you want an Integer (32 bits))
b) Dim 'tmp' as a string, and 'a' as integer, not objects. That clears
off the first 3 upgrade warnings.
c) Switch Option Strict On - it's there to help - not just fill up the
task list/error list!!

This is the MSDN entry for WaveOutSetVolume. I'm suprised you couldn't
find it in your local MSDN(??).
http://msdn.microsoft.com/library/de...tsetvolume.asp
Start there, and go through each of the "See Also" items to get your
head round how the API call works.

This post sets the WaveOutVolume to 0. Note the different API
declaration to your "old" method.
http://forums.microsoft.com/MSDN/Sho...78167&SiteId=1

Hope that gets you started.
__________________________________________________ ___
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Ok I am not a programmer, I copied some code and very painfully got it
working in VB6. I can adjust the volume with waveOutSetVolume on
winmm.dll. But I could not seem to be able to figure out how to adjust
the master volume. I thought maybe if I upgraded this into VS2005
VB.Net then it might be a little easier. But now I am getting
PInvokeStackImbalance messages on this, and it doesn't even run. We're
talking a very little program... A programmer-friend of mine told me
this might be related to me calling dlls instead of using namespaces,
he thinks something.computer.soundcard.volume.set or some such thing.
My experience is vbScript so I am lost - I read you can't do this in
vbScript, there are lots of questions out there about how do you
control the master volume, lots of answers that dodge that question...
anyone want to take a stab at fixing this, or pointing me to a good
help-myself point? I do have MSDN Library but I have not made it
through the whole DVD yet :op I'm not sure what to even search for. I
suspect there is something like waveOutSetVolume but not starting with
wave....

Anyway first is the VB.Net conversion (this is all in the form code),
complete with errors, then is the vb6 code that works - type in a
percent and it sets the wave volume.

TIA if anyone wants to take a stab at it...

--
Rich Milburn
[MVP - Directory Services]

'----------------vbNet code-----------------------------
' This gets several errors from the conversion from vb6, most of it is
copied and modified from vb6 (I think) examples

Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByVal dwVolume As Integer) As Short
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Short, ByRef lpdwVolume As Integer) As Short

Const SND_ASYNC As Short = &H1s
Const SND_NODEFAULT As Short = &H2s

Dim CurrentVolLeft As Integer
Dim CurrentVolRight As Integer

Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles SetMaxVol.Click
Dim x As Short
Dim a As Object
Dim i As Integer
Dim tmp As Object
Dim vol As String
vol = CStr(CDbl(Text1.Text) / 100 * 65535)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp.
Click for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
'UPGRADE_WARNING: Couldn't resolve default property of object tmp.
Click for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
vol = CStr(CInt("&H" & tmp & tmp))
'UPGRADE_WARNING: Couldn't resolve default property of object a. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
a = waveOutSetVolume(0, CInt(vol))

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub

Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdRefresh.Click
Dim x As Short
Dim BothVolumes As Integer
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF

CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF
LeftVol.Text = Hex(CurrentVolLeft)
RightVol.Text = Hex(CurrentVolRight)
tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
Text1.Text = CStr((CInt(tmp) / 65535) * 100)

End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles MyBase.Load
cmdRefresh_Click(cmdRefresh, New System.EventArgs())
End Sub
End Class
'------------------ end vbNet code--------------------------
'vb6 code -----------------------------------------------
'this works for wave volume, but could not figure out master volume
Option Explicit
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
wDeviceID As Integer, lpdwVolume As Long) As Integer
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Dim CurrentVolLeft As Long
Dim CurrentVolRight As Long
Private Sub SetMaxVol_Click()
Dim x As Integer
Dim a, i As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)

' x = waveOutSetVolume(0, &HFFFFFFFF)
End Sub
Private Sub cmdRefresh_Click()
Dim x As Integer
Dim BothVolumes As Long
Dim tmp As String

x = waveOutGetVolume(0, BothVolumes)
CurrentVolLeft = BothVolumes And &HFFFF&

CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And
&HFFFF&
LeftVol.Caption = Hex$(CurrentVolLeft)
RightVol.Caption = Hex$(CurrentVolRight)
tmp = "&h" & Right(Hex$(BothVolumes), 4)
Text1 = (CLng(tmp) / 65535) * 100
End Sub

Private Sub Form_Load()
cmdRefresh_Click
End Sub
'--------------------- end vb6
code -----------------------------------------------



Feb 10 '06 #7
It's nice to hear that for a change!
If you ever get the code converted up to VB 2005, I'd be very interested!
Got a lot of other stuff to do before I get round to it though :(
________________________________________________
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
You Rock! it works great! I'll post the code here in case anyone is
interested. I have a command button called SetVol, and a text box called
Text1. Enter the percentage in the box and it sets both the master and
wave vol levels together.
it's mostly from that code at devx...
Rich

--
Rich Milburn
[MVP - Directory Services]

Const MMSYSERR_NOERROR = 0
Const MAXPNAMELEN = 32
Const MIXER_LONG_NAME_CHARS = 64
Const MIXER_SHORT_NAME_CHARS = 16
Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Const MIXER_SETCONTROLDETAILSF_VALUE = &H0&
Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = &H4
Const MIXERCONTROL_CONTROLTYPE_VOLUME = &H50030001

Private Declare Function mixerOpen Lib "WINMM.DLL" (phmx As Long, _
ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As
Long, _
ByVal fdwOpen As Long) As Long
Private Declare Function mixerGetLineInfo Lib "WINMM.DLL" Alias _
"mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, _
ByVal fdwInfo As Long) As Long
Private Declare Function mixerGetLineControls Lib "WINMM.DLL" Alias _
"mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As
MIXERLINECONTROLS, _
ByVal fdwControls As Long) As Long
Private Declare Function mixerSetControlDetails Lib "WINMM.DLL" (ByVal
hmxobj _
As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As
Long
Private Declare Function mixerClose Lib "WINMM.DLL" (ByVal hmx As Long) As
Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long,
_
ByVal dwBytes As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hmem As Long) As
Long
Private Declare Function GlobalFree Lib "kernel32" (ByVal hmem As Long) As
Long
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID
As Integer, ByVal dwVolume As Long) As Integer
Private Type MIXERCONTROL
cbStruct As Long
dwControlID As Long
dwControlType As Long
fdwControl As Long
cMultipleItems As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
lMinimum As Long
lMaximum As Long
reserved(10) As Long
End Type

Private Type MIXERCONTROLDETAILS
cbStruct As Long
dwControlID As Long
cChannels As Long
item As Long
cbDetails As Long
paDetails As Long
End Type

Private Type MIXERCONTROLDETAILS_UNSIGNED
dwValue As Long
End Type

Private Type MIXERLINE
cbStruct As Long
dwDestination As Long
dwSource As Long
dwLineID As Long
fdwLine As Long
dwUser As Long
dwComponentType As Long
cChannels As Long
cConnections As Long
cControls As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
dwType As Long
dwDeviceID As Long
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
End Type

Private Type MIXERLINECONTROLS
cbStruct As Long
dwLineID As Long
dwControl As Long
cControls As Long
cbmxctrl As Long
pamxctrl As Long
End Type

' Set the master volume level.
'
' VolumeLevel is the level value in percentage (0 = min, 100 = max)
' Returns True if successful

Function SetVolume(VolumeLevel As Long) As Boolean
Dim hmx As Long
Dim uMixerLine As MIXERLINE
Dim uMixerControl As MIXERCONTROL
Dim uMixerLineControls As MIXERLINECONTROLS
Dim uDetails As MIXERCONTROLDETAILS
Dim uUnsigned As MIXERCONTROLDETAILS_UNSIGNED
Dim RetValue As Long
Dim hmem As Long

' VolumeLevel value must be between 0 and 100
If VolumeLevel < 0 Or VolumeLevel > 100 Then GoTo error

' Open the mixer
RetValue = mixerOpen(hmx, 0, 0, 0, 0)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Initialize MIXERLINE structure and call mixerGetLineInfo
uMixerLine.cbStruct = Len(uMixerLine)
uMixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS
RetValue = mixerGetLineInfo(hmx, uMixerLine, _
MIXER_GETLINEINFOF_COMPONENTTYPE)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Initialize MIXERLINECONTROLS strucure and
' call mixerGetLineControls
uMixerLineControls.cbStruct = Len(uMixerLineControls)
uMixerLineControls.dwLineID = uMixerLine.dwLineID
uMixerLineControls.dwControl = MIXERCONTROL_CONTROLTYPE_VOLUME
uMixerLineControls.cControls = 1
uMixerLineControls.cbmxctrl = Len(uMixerControl)

' Allocate a buffer to receive the properties of the master volume
control
' and put his address into uMixerLineControls.pamxctrl
hmem = GlobalAlloc(&H40, Len(uMixerControl))
uMixerLineControls.pamxctrl = GlobalLock(hmem)
uMixerControl.cbStruct = Len(uMixerControl)
RetValue = mixerGetLineControls(hmx, uMixerLineControls, _
MIXER_GETLINECONTROLSF_ONEBYTYPE)
If RetValue <> MMSYSERR_NOERROR Then GoTo error

' Copy data buffer into the uMixerControl structure
CopyMemory uMixerControl, ByVal uMixerLineControls.pamxctrl, _
Len(uMixerControl)
GlobalFree hmem
hmem = 0

uDetails.item = 0
uDetails.dwControlID = uMixerControl.dwControlID
uDetails.cbStruct = Len(uDetails)
uDetails.cbDetails = Len(uUnsigned)

' Allocate a buffer in which properties for the volume control are set
' and put his address into uDetails.paDetails
hmem = GlobalAlloc(&H40, Len(uUnsigned))
uDetails.paDetails = GlobalLock(hmem)
uDetails.cChannels = 1
uUnsigned.dwValue = CLng((VolumeLevel * uMixerControl.lMaximum) / 100)
CopyMemory ByVal uDetails.paDetails, uUnsigned, Len(uUnsigned)

' Set new volume level
RetValue = mixerSetControlDetails(hmx, uDetails, _
MIXER_SETCONTROLDETAILSF_VALUE)
GlobalFree hmem
hmem = 0
If RetValue <> MMSYSERR_NOERROR Then GoTo error

mixerClose hmx
' signal success
SetVolume = True
Exit Function

error:
' An error occurred

' Release resources
If hmx <> 0 Then mixerClose hmx
If hmem Then GlobalFree hmem
' signal failure
SetVolume = False

End Function

Private Sub SetWaveVol(VolumeLevel As Long)
Dim a As Long
Dim tmp, vol As String
vol = VolumeLevel / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub

Private Sub SetVol_Click()
SetVolume (Text1.Text)
SetWaveVol (Text1.Text)
End Sub

"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Right.. after over 10 minutes of digging through my 500 gig hard
drive.... lol... found my old code!
I used the MixerLine and Mixer structures and some different APIs to the
WaveOutSetVolume thingy.
A quick search on MSDN found the link below, which is a bit clearer than
my old code!

http://www.devx.com/vb2themax/Tip/19...ticle&trk=MSCP

Hope that helps get your master volume under control!
______________________________________________
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:uL*************@tk2msftngp13.phx.gbl...
I downloaded the source code you referred to, and tried to wade through
it... it sure does a lot of stuff... I did indeed already find the MSDN
link on waveOutSetVolume, and I have indeed gotten that one working.
What I could not figure out is what is the comparable API for
MasterOutSetVolume - not that it is called that, it's not - if it was, I
wouldn't have to ask :)
I did post this to directx.audio also, but that group is pretty slow...

I cut my vb6 code down to:

Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
wDeviceID
As Integer, ByVal dwVolume As Long) As Integer

Private Sub SetVol_Click()
Dim a As Long
Dim tmp, vol As String
vol = Text1 / 100 * 65535
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub

any ideas what the master volume set function is called, or how I can
find out? Did you figure that out in VB6?
thanks again -
Rich
--
Rich Milburn
[MVP - Directory Services]

"The Grim Reaper" <gr*********@REMOVEbtopenworld.com> wrote in message
news:ds**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I managed to write a class to control Wave, Master, CD player, Line In
and Microphone volumes in the windows mixer many years ago.
It was in VB6, and took me several months of research to build it all!
I upgraded it to VB2003 a few years ago, but I don't think I ever got
it working like it used to.
This article is the most useful one I've found so far - it's C#, but I
find that easier to translate to VB.NET than VB6 sometimes!
http://www.codeproject.com/useritems/AudioLib.asp

As for your code below, here's a few pointers;
a) Change your As Short declarations to As Integer (a Long in VB6
translates to a Short in .NET, you want an Integer (32 bits))
b) Dim 'tmp' as a string, and 'a' as integer, not objects. That clears
off the first 3 upgrade warnings.
c) Switch Option Strict On - it's there to help - not just fill up the
task list/error list!!

This is the MSDN entry for WaveOutSetVolume. I'm suprised you couldn't
find it in your local MSDN(??).
http://msdn.microsoft.com/library/de...tsetvolume.asp
Start there, and go through each of the "See Also" items to get your
head round how the API call works.

This post sets the WaveOutVolume to 0. Note the different API
declaration to your "old" method.
http://forums.microsoft.com/MSDN/Sho...78167&SiteId=1

Hope that gets you started.
__________________________________________________ ___
The Grim Reaper

"Rich Milburn [MVP]" <richdotmilburnatapplebeesdotcom> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
> Ok I am not a programmer, I copied some code and very painfully got it
> working in VB6. I can adjust the volume with waveOutSetVolume on
> winmm.dll. But I could not seem to be able to figure out how to adjust
> the master volume. I thought maybe if I upgraded this into VS2005
> VB.Net then it might be a little easier. But now I am getting
> PInvokeStackImbalance messages on this, and it doesn't even run.
> We're talking a very little program... A programmer-friend of mine
> told me this might be related to me calling dlls instead of using
> namespaces, he thinks something.computer.soundcard.volume.set or some
> such thing. My experience is vbScript so I am lost - I read you can't
> do this in vbScript, there are lots of questions out there about how
> do you control the master volume, lots of answers that dodge that
> question... anyone want to take a stab at fixing this, or pointing me
> to a good help-myself point? I do have MSDN Library but I have not
> made it through the whole DVD yet :op I'm not sure what to even
> search for. I suspect there is something like waveOutSetVolume but
> not starting with wave....
>
> Anyway first is the VB.Net conversion (this is all in the form code),
> complete with errors, then is the vb6 code that works - type in a
> percent and it sets the wave volume.
>
> TIA if anyone wants to take a stab at it...
>
> --
> Rich Milburn
> [MVP - Directory Services]
>
> '----------------vbNet code-----------------------------
> ' This gets several errors from the conversion from vb6, most of it is
> copied and modified from vb6 (I think) examples
>
> Option Strict Off
> Option Explicit On
> Imports VB = Microsoft.VisualBasic
> Friend Class Form1
> Inherits System.Windows.Forms.Form
> Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
> wDeviceID As Short, ByVal dwVolume As Integer) As Short
> Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
> wDeviceID As Short, ByRef lpdwVolume As Integer) As Short
>
> Const SND_ASYNC As Short = &H1s
> Const SND_NODEFAULT As Short = &H2s
>
> Dim CurrentVolLeft As Integer
> Dim CurrentVolRight As Integer
>
> Private Sub SetMaxVol_Click(ByVal eventSender As System.Object, ByVal
> eventArgs As System.EventArgs) Handles SetMaxVol.Click
> Dim x As Short
> Dim a As Object
> Dim i As Integer
> Dim tmp As Object
> Dim vol As String
> vol = CStr(CDbl(Text1.Text) / 100 * 65535)
> 'UPGRADE_WARNING: Couldn't resolve default property of object tmp.
> Click for more:
> 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
> tmp = VB.Right(Hex(CDbl(vol) + 65536), 4)
> 'UPGRADE_WARNING: Couldn't resolve default property of object tmp.
> Click for more:
> 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
> vol = CStr(CInt("&H" & tmp & tmp))
> 'UPGRADE_WARNING: Couldn't resolve default property of object a. Click
> for more:
> 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
> a = waveOutSetVolume(0, CInt(vol))
>
> ' x = waveOutSetVolume(0, &HFFFFFFFF)
> End Sub
>
> Private Sub cmdRefresh_Click(ByVal eventSender As System.Object, ByVal
> eventArgs As System.EventArgs) Handles cmdRefresh.Click
> Dim x As Short
> Dim BothVolumes As Integer
> Dim tmp As String
>
> x = waveOutGetVolume(0, BothVolumes)
> CurrentVolLeft = BothVolumes And &HFFFF
>
> CurrentVolRight = (CShort(BothVolumes And &HFFFF0000) / &H10000) And
> &HFFFF
> LeftVol.Text = Hex(CurrentVolLeft)
> RightVol.Text = Hex(CurrentVolRight)
> tmp = "&h" & VB.Right(Hex(BothVolumes), 4)
> Text1.Text = CStr((CInt(tmp) / 65535) * 100)
>
> End Sub
>
>
> Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal
> eventArgs As System.EventArgs) Handles MyBase.Load
> cmdRefresh_Click(cmdRefresh, New System.EventArgs())
> End Sub
> End Class
> '------------------ end vbNet code--------------------------
> 'vb6 code -----------------------------------------------
> 'this works for wave volume, but could not figure out master volume
> Option Explicit
> Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal
> wDeviceID As Integer, ByVal dwVolume As Long) As Integer
> Private Declare Function waveOutGetVolume Lib "WINMM.DLL" (ByVal
> wDeviceID As Integer, lpdwVolume As Long) As Integer
> Const SND_ASYNC = &H1
> Const SND_NODEFAULT = &H2
> Dim CurrentVolLeft As Long
> Dim CurrentVolRight As Long
> Private Sub SetMaxVol_Click()
> Dim x As Integer
> Dim a, i As Long
> Dim tmp, vol As String
> vol = Text1 / 100 * 65535
> tmp = Right((Hex$(vol + 65536)), 4)
> vol = CLng("&H" & tmp & tmp)
> a = waveOutSetVolume(0, vol)
>
> ' x = waveOutSetVolume(0, &HFFFFFFFF)
> End Sub
> Private Sub cmdRefresh_Click()
> Dim x As Integer
> Dim BothVolumes As Long
> Dim tmp As String
>
> x = waveOutGetVolume(0, BothVolumes)
> CurrentVolLeft = BothVolumes And &HFFFF&
>
> CurrentVolRight = ((BothVolumes And &HFFFF0000) / &H10000) And
> &HFFFF&
> LeftVol.Caption = Hex$(CurrentVolLeft)
> RightVol.Caption = Hex$(CurrentVolRight)
> tmp = "&h" & Right(Hex$(BothVolumes), 4)
> Text1 = (CLng(tmp) / 65535) * 100
> End Sub
>
> Private Sub Form_Load()
> cmdRefresh_Click
> End Sub
> '--------------------- end vb6
> code -----------------------------------------------
>
>



Feb 11 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dreamer | last post by:
I am making a program for a friend with a disability. I need to adjust his audio volume using the keyboard as he cannot use a mouse. Any suggestions as to how I can raise the volume using the up...
6
by: Beren | last post by:
Hi all I'm almost braindead on this one, but how can I create a master/detail datagrid in this format : CatA subcatA1 subcatA2 subcatA3
0
by: Stefan Basler | last post by:
Hi there, I'm currently working on a VB .NET project in which I need to control the master and / or the line in of the installed sound card. I managed to control the wave volume by using...
9
by: Hugo | last post by:
Hello What is the better way to control sound volume ? hugo
2
by: Bob Day | last post by:
Using VS 2003, VB. Net, MSDE... Usining task sheduler, I wish to mute the volume in the .bat file that task scheduler runs (windows XP Pro). I don't see anyway to do this via a .bat line...
2
by: John Clark | last post by:
Hello all, I'm developing an application thats operation requires the volume NOT to be muted - for notification purposes. I've had a quick look round and don't seem to be having much luck -...
1
by: Christopher A. Kelly | last post by:
I need to figure out how to control any 3rd party application by simulating mouse click and key presses. I need to take a partial window title and get the handle then be able to send the necessary...
3
by: Mike Carlisle | last post by:
Hi, Can someone give me some help on setting the master volume control in Vista. I've looked everywhere and there seems to be very little help on this. The only information I can find is that I...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.