Solved

Control Master Volume From App..

Posted on 1998-08-18
8
390 Views
Last Modified: 2012-08-13
How can I control the system volume from within my app using API? I found sample code for controlling the wav volumes, but I would like to control ALL output. The master volume I guess it could be called...

Thanks

Gary
0
Comment
Question by:garymace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 1

Expert Comment

by:kuk010998
ID: 1429751
Well, I really do not want points for this, but Dr. GUI had an answer a while ago. I think copying the text here would not be legal, but it should be available online... Lemme see... Oops, MS's MSDN site is incompatible with ie3...  Nah, can't find it. It was in MSDN news (the big newsletter coming with a MSDN subscription) March/april 1998 (Vol. 7 Number 2), page 3, bottom of 1st column. You got access to that? The article mentions "There is no simple API", the function names "mixerGetNumDevs", "mixerGetLineInfo", "mixerGetLineControls" and "mixerGetControlDetails", and bugs in win32api.txt...

Have fun!
0
 
LVL 1

Expert Comment

by:kuk010998
ID: 1429752
0
 

Author Comment

by:garymace
ID: 1429753
No, I do not have access to MSDN. Thanks anyway..

Gary

0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 1

Expert Comment

by:kuk010998
ID: 1429754
Didn't they offer MSDN online free? Might be worth a try. On the other hand, the 'premium' in the URL above might exclude you again... In any case, that article did not offer a complete solution anyway, so you'd search the MSDN library for those keywords I gave. The MSDN library is a must anyway.
0
 
LVL 1

Accepted Solution

by:
nilos earned 20 total points
ID: 1429755
Dr. GUI is gratified that you're concerned for your users' hearing. It speaks volumes for your intelligence and compassion. There are few things more annoying than an application that's just too noisy. It's almost as bad as stealing focus from the foreground application.

Unfortunately, there is no simple API call to get or set the volume. It requires iterating through four layers of functions and structures to get or set the system volume.

First, call mixerGetNumDevs to locate the correct mixer device. Next, call mixerGetLineInfo to determine which line of the device controls the volume to the speakers. Then, call mixerGetLineControls to determine which control on that line lets you change the volume. Finally, call mixerGetControlDetails to obtain the structure containing the volume setting.

To actually change the volume you must work around Visual Basic's limited ability to handle pointers. (Or you could write a COM object in Visual C++ to do this.) The availability of the VarPtr() function in Visual Basic 5.0 smooths the way considerably. Note that you'll have to declare some of the structures and functions yourself because of bugs in the WIN32API.TXT file that shipped with Visual Basic.

By the way, it would probably be a good idea to put the volume back when your application exits—changing it permanently for the user is kinda rude.


0
 
LVL 1

Expert Comment

by:kuk010998
ID: 1429756
That's the text I meant. Just I do not republish copyrighted information...
0
 
LVL 1

Expert Comment

by:nilos
ID: 1429757
I was concerned about to publish copyrighted info but, in this case I did not break any copyright law because:

a) Dr. Guy is a public information
b) I do not publish his text pretending it was mine
c) This place is not a public, in the strict sense, place

d) garymace needs this information to do a better usage of a Microsoft product.

Based on that I don't think that Microsoft will sue me.





0
 

Author Comment

by:garymace
ID: 1429758
Thank you nilos for the post.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question