VBScript or other language to adjust advanced Xp volume settings

Posted on 2006-04-11
Medium Priority
Last Modified: 2013-12-03
Does anyone know of a programming solution to adjust the advanced volume settings in a Windows XP Pro machine that does not involve using the "SendKeys" function to emulate keystrokes?  That solution doesn't always work, and takes too long as the script is being processed.

The settings I'm referring to can be manually edited by going to the Control Panel -> Sounds and Audio Devices -> Advanced.  Once there, the settings I need to adjust are for:

Speaker, Wave, SW Synth, CD Player

I and my collegues have looked around on Microsoft and other's sites for an extremely long time and have not found a way to do this.  I'm hoping a windows guru out there has had to do just this thing before and can make us feel silly by not finding it sooner.  Surely there must be some registry key or something to edit for these, but I can't find it.  Any reliable, quickly executing, programming solution in any language would be an acceptable answer.  Using the sendkey's function doesn't work reliably, as to adjust this it takes a long time as .NET, VB and VBScript programs process the commands to lower the scrollbars.  I really need something that can set the values by sending a specific command or number and not by looping a specific number of times.

Thanks for ideas and help!  If there's no solution by April 30 the most creative programming attempt not using SendKeys gets the points, but the attempt must be in good faith and not be just garbage.  Please help and good luck!
Question by:thinkscript
  • 2
LVL 41

Accepted Solution

graye earned 1000 total points
ID: 16447994
This is gonna take a wee bit of experimentation to get it right.

Basically you can edit the registry directly to obtain the same effect as the a human moving the slide controls...  The trick is finding the correct device ID and the channel number that corresponds to the Speaker, Wave, etc

Here's what you need to do...  

Start with opening the registry editor and navigate to:

One of the keys below this point will have a key called "#WAVE\Control"
And it will have a DWORD value called "Linked"\
Just poke around in each key until you find it

Now, you've discovered the Device ID part of the puzzle... it will be insanely long (in my case the key is: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{6994AD04-93EF-11D0-A3CC-00A0C9223196}\##?#PCI#VEN_1106&DEV_3059&SUBSYS_812A1043&REV_60#3&267A616A&0&8D#{6994ad04-93ef-11d0-a3cc-00a0c9223196})

OK, next we need to discover the mapping of the channel numbers to the control sliders...  This will take a bit of experimentation.  For example, when I changed the Wave volume on my PC, the values for "Channel0" and "Channel1" changed at:
<insanely long key>\#Wave\Device Parameters\Mixer\2\Controls\0
So, that means channel 2 is for the "Wave" slider (on my system)... you'll need to test each one to find the slider-to-channel match

After you've mapped the channels, you can create a registry file that can easily be scripted (or just double-clicked on) to immediately adjust the volumes).  It would look like this (with idential entries for the other "channels", ie : Speaker, SW Synth, and CD Player

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{6994AD04-93EF-11D0-A3CC-00A0C9223196}\##?#PCI#VEN_1106&DEV_3059&SUBSYS_812A1043&REV_60#3&267A616A&0&8D#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\#Wave\Device Parameters\Mixer\2\Controls\0]

Author Comment

ID: 16503452
Oh....this will be so ugly since it has to run on any machine.  Still, I think using substrings and alot of loops it will work for me.

Thanks for the tip.  It's definitely the right direction for this problem and looks really promising.

Author Comment

ID: 16503461
So much more work to actually turn this into a programmable solution though...

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

862 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