pitcherj Posted May 23, 2007 Posted May 23, 2007 Is there a way I can retrieve the current volume as a percentage or in some other format? I'm looking to create a volume indicator which appears when the system volume is changed. I can't seem to find anything but a way to set the volume with SoundSetWaveVolume.
Gif Posted May 23, 2007 Posted May 23, 2007 Is there a way I can retrieve the current volume as a percentage or in some other format? I'm looking to create a volume indicator which appears when the system volume is changed. I can't seem to find anything but a way to set the volume with SoundSetWaveVolume.well its a bit difficult , i dont think you cn do that because the volume is changed on the speakers and the computer doesnt take any action in the changing of the volume
GaryFrost Posted May 23, 2007 Posted May 23, 2007 well its a bit difficult , i dont think you cn do that because the volume is changed on the speakers and the computer doesnt take any action in the changing of the volumethe user is not talking about the volume knob on the speakers.The master volume on the volume control, and yes it is possible, a search should reveal it has been done before. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
pitcherj Posted May 23, 2007 Author Posted May 23, 2007 Well, I've tried using the script referred to in this post: http://www.autoitscript.com/forum/index.ph...rt=#entry338780, however I was unable to even get the base script to change the volume. Windows Vista has a completely re-designed mixer and apparently you can no longer hook into the dll file as that script does (even if the executable is running in windows XP compatability mode).Jacob
GaryFrost Posted May 23, 2007 Posted May 23, 2007 Might take a look at: http://www.autoitscript.com/forum/index.ph...st&p=327627 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
pitcherj Posted May 23, 2007 Author Posted May 23, 2007 (edited) Might take a look at: http://www.autoitscript.com/forum/index.ph...st&p=327627According to the comments in that script it only functions when Windows Media Player is open.; Notes ........: Does Not Affect System/Wave Volumes!!I need something that can display the main system volume when it changes. Edited May 23, 2007 by pitcherj
pitcherj Posted May 27, 2007 Author Posted May 27, 2007 Unfortunately, I ended up going with a program someone already wrote. I got to the point of spending so much time trying to come up with a solution on my own that it wasn't even worth it anymore.
FreeFry Posted May 27, 2007 Posted May 27, 2007 (edited) Just to add to this, here is how I did it: expandcollapse popupOpt("WinTitleMatchMode", 4) DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) ; A workaround to get it to work on Windows XP 64bit, I'm not sure if this have been fixed or not by now.. Global $pID = 0 Global $WindowHandle = 0 Global $ControlHandle1 = 0 Global $ControlHandle2 = 0 Global $Muted = False Global Const $TBM_GETPOS = 0x400 Global Const $TBM_SETPOS = 0x405 Global Const $WM_VSCROLL = 0x115 $g_szVersion = "Volume Control Fixer v1.1" If WinExists($g_szVersion) Then Exit AutoItWinSetTitle($g_szVersion) While 1 If Not WinExists($WindowHandle) Then _GetHandles() Else $data1 = DllCall("user32.dll", "int", "SendMessage", "hwnd", $ControlHandle1, "int", $TBM_GETPOS, "int", 0, "int", 0) $data2 = DllCall("user32.dll", "int", "SendMessage", "hwnd", $ControlHandle2, "int", $TBM_GETPOS, "int", 0, "int", 0) If $data1[0] <> $data2[0] Then DllCall("user32.dll", "int", "SendMessage", "hwnd", $ControlHandle2, "int", $TBM_SETPOS, "int", True, "long", $data1[0]) DllCall("user32.dll", "int", "SendMessage", "hwnd", $WindowHandle, "int", $WM_VSCROLL, "int", $SB_LINEDOWN, "int", $ControlHandle2) ElseIf ControlCommand($WindowHandle, "", "Button2", "IsChecked") And Not $muted Then ; Sound is muted ControlCommand($WindowHandle, "", "Button4", "Check") TrayTip("Muted!", "Sound Muted!", 0) $muted = True ElseIf Not ControlCommand($WindowHandle, "", "Button2", "IsChecked") And $muted Then ; Sound is unmuted ControlCommand($WindowHandle, "", "Button4", "UnCheck") TrayTip("Unmuted!", "Sound Unmuted!", 0) $muted = False EndIf EndIf Sleep(100) WEnd Func OnAutoItExit() If ProcessExists($pID) Then ProcessClose($pID) EndIf EndFunc ;==>OnAutoItExit Func _GetHandles() $pID = Run(@SystemDir & "\sndvol32.exe", @SystemDir);, @SW_HIDE) If Not WinWait("classname=Volume Control", "", 7500) Then MsgBox(0, "Error!", "Volume Control Could not be opened! Exiting..") Exit EndIf $WindowHandle = WinGetHandle("classname=Volume Control") $ControlHandle1 = ControlGetHandle($WindowHandle, "", 1001) $ControlHandle2 = ControlGetHandle($WindowHandle, "", 2001) EndFunc I used this when I had a keyboard with volume control buttons on it, but it did only change the wave volume, and I wanted it to change "all" volume controls, so I made it lock the Wave volume sliders with the System Volume sliders. Edited May 27, 2007 by FreeFry
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now