Jump to content

Control Vista+ Master Volume


Recommended Posts

@wraithdu

You sent me here from a post in help and support, yet, it hasn't fixed my problem, with Vista it moves the volume fine (as it did with SoundSetWave)

But on Windows 7 nothing.

Image below.

Posted Image

My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.

Link to post
Share on other sites
  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

UPDATE: With the addition of the ObjCreateInterface function and enhanced COM functionality by trancexxx, these interfaces are now accessible directly in AutoIt. I've rewritten the plugin as a native

Yes that's true of course (I wrote this plugin and UDF after all ), but it is worth noting that those two volume controls on XP *can* be discreet, it may depend on the sound drivers installed. So cha

Your screenshot, while illustrative, tells me nothing about how you are using the plugin in code. Are you sure you're using it correctly? Because I use it daily on my Win7 laptop as part of my OSD volume control.

Link to post
Share on other sites

Also, isn't that Windows 8 you're running it on? Has it been tested to work on Windows 8 yet? I tend to doubt that. Things may have changed again in the newest version of Windows from the previous versions.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites
  • 2 months later...

Not to step on any toes, but there is a much much simpler way, and it works for all os. However, it does require the use of a third-party program, which on the positive side is 100% freeware is also 100% completely transportable and self-running. So you can 'carry' it with your AutoIt program and just call it from there.

The program i am referring to is NirCmd and can be found @ http://www.nirsoft.net/utils/nircmd.html

Then is just as easy as:

Func volDown()
Run("nircmd.exe changesysvolume -2000")
ToolTip("volume down")
Sleep(500)
ToolTip("")
EndFunc;; end volDown
Func volUp()
Run("nircmd.exe changesysvolume 2000")
ToolTip("volume up")
Sleep(500)
ToolTip("")
EndFunc;; end volUp

There noting to install and uses just 1 line of code. just get rid of the the 'tooltip' and 'sleep' crap :graduated:

Link to post
Share on other sites

For some reason it forums would not let me edit previous post.

Just wanted to add a zip file that uses hotkeys to control system volume.

http://dcs777.homeip.net/sites/default/files/dl/xcv/cpp.zip

contains nircmd.exe and ccp_v-2-1.au3 (a simple script that controls system volume via hotkeys)

Link to post
Share on other sites
  • 6 months later...

sry if this is out of the topic but does this dll work for windows xp as well or this is purely for vista/win7 only ? anyway to merge xp soundsetwave in this as well so i can use this for both os ?

You would need to have 2 different functions one for XP and one for Vista, controlling the playback level in XP is straightforward because you can control it directly. In Vista/7 your application can only control its own volume and not the whole system's volume without a workaround.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

well i need to hook to detect volume change. if i do soundgetvolume in loop it creates about 30% cpu load. i am trying to make a program to limit volume. i am thinking ur dll can do it with less load than soundgetvolume. thanks for reply

Link to post
Share on other sites

Stay tuned... the current stable release of AutoIt introduced the ObjCreateInterface function, which means I can do this now without a plugin. I've already got it working, just need to flesh out the interface functions and create the UDF.

Link to post
Share on other sites

Works on Windows 7 x64. Thanks.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to post
Share on other sites

wraithdu, I noticed you've dropped the "Vista" suffix from the functions, does this mean they will work on earlier versions of Windows as well, or do these functions still only apply to Vista+ with the new mixer setup?

Also, I just have to tell this little story because I found it amusing. I haven't been back to the site in forever, and barely write script/code at all lately, but just a week or so ago I finished an application I'd been tinkering with off and on for a long time (like years, my oldest backed up file is from 2007) and hadn't realized that the vista_vol plugin could not be loaded by 64 bit compiled app's until I had errors whenever I tried the volume functions. I came here looking for a solution and lo and behold you've just rewritten it as a UDF. I mean really, what are the chances?

Anyway, thanks for an awesome plugin, and now an awesome UDF.

Link to post
Share on other sites

You're welcome ;)

I renamed the functions to better reflect the interface method names, the functionality has not changed. These functions are not needed pre-Vista at all, you can use the normal Sound functions on XP.

Link to post
Share on other sites

I renamed the functions to better reflect the interface method names, the functionality has not changed.

Oh ok, cool.

These functions are not needed pre-Vista at all, you can use the normal Sound functions on XP.

Well there are no functions for master volume, but I have a UDF from another forum post that helps me with those. Thanks again.
Link to post
Share on other sites
  • 4 weeks later...

New udf works on my win7 X64 too. Thanks alot. i might sound rude for saying this. sorry if i do. I still think it's for the better of autoit if u can combine this udf with the xp vol control too so 1 udf is all thats needed for volume control for autoit. easier for new coders.

Link to post
Share on other sites

Well there are no functions for master volume, but I have a UDF from another forum post that helps me with those. Thanks again.

The Master Volume in XP is the only one you ever need to control, the problem occurs in Vista+ because applications generally can only control their own volume, and not the Master volume control. Applications in XP don't have their own volume settings in the speaker icon.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

The Master Volume in XP is the only one you ever need to control.

Not quite. XP has WAV Volume and Master Volume. Master controls everything, and WAV is for typical sound output like music players. The built-in Sound functions don't have a true Master Volume control, but control the WAV level. Edited by wraithdu
Link to post
Share on other sites

Unfortunately, in XP, almost everything useful goes through the WAV volume control, so the master volume control and the WAV volume control just piggyback on each other. The point I was making was that in Vista+, you can't get to the master volume control without some kind of work around like this UDF because Vista+ only lets an application control its own volume and not the system volume.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...