VBScript or other language to adjust advanced Xp volume settings

Posted on 2006-04-11
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
    LVL 41

    Accepted Solution

    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

    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

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

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
    This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
    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.…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now