- Offizieller Beitrag
Hi,
kein Großes Werk - aber da mir der Standardregler von Windows zu mickrig ist für eine saubere Lautstärkeregelung und ich auch keine Lust habe erst in meiner Trayleiste zu "wühlen" , habe ich mal schnell einen eigenen Regler erstellt der sich sofort einblendet, wenn ich mit der Maus den Desktopbereich nach rechts verlasse und auch selbständig wieder verschwindet
Vielleicht ist es ja auch für jemand anderen von Interesse.
Benötigt wird dafür die audio.au3 von hier
Edit:
Hier noch eine Version mit Switch auf Mikroeinstellung.
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
#include <audio.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("^+{F6}", "_exitVol")
Global $pos1[2] = [@DesktopWidth, @DesktopHeight/2 -108]
Global $pos2[2] = [@DesktopWidth-45, @DesktopHeight/2 -108]
Global $moved = False
$guiSpeaker = GUICreate("Ton", 38, 216, $pos1[0], $pos1[1], BitOR($WS_MINIMIZEBOX,$WS_CAPTION, _
$WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
$slVol = GUICtrlCreateSlider(8, 16, 20, 150, BitOR($TBS_VERT,$TBS_TOP,$TBS_LEFT,$TBS_NOTICKS))
GUICtrlSetOnEvent(-1, "slVolChange")
GUICtrlSetData(-1, 100-_SoundGetMasterVolume())
$cbMute = GUICtrlCreateCheckbox("", 11, 173, 17, 17)
GUICtrlSetOnEvent(-1, "cbMuteClick")
If _isMute() Then
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetState($slVol, $GUI_DISABLE)
EndIf
$Label1 = GUICtrlCreateLabel("Aus", 9, 194, 22, 17)
GUISetState(@SW_SHOW)
While 1
Sleep(100)
_checkPos()
WEnd
Func _exitVol()
Exit
EndFunc
Func cbMuteClick()
If BitAND(GUICtrlRead($cbMute), $GUI_CHECKED) Then
GUICtrlSetState($slVol, $GUI_DISABLE)
Else
GUICtrlSetState($slVol, $GUI_ENABLE)
EndIf
_ToggleMuteMaster()
EndFunc
Func slVolChange()
_SoundSetMasterVolume(100- GUICtrlRead($slVol))
EndFunc
Func _checkPos()
Local $mouse = MouseGetPos()
If ($mouse[0]+3 > $pos1[0]) Then
WinMove($guiSpeaker, '', $pos2[0], $pos2[1])
$moved = True
ElseIf $moved And ($mouse[0] < $pos1[0]-50) Then
WinMove($guiSpeaker, '', $pos1[0], $pos1[1])
$moved = False
EndIf
EndFunc
Func _ToggleMuteMaster($opt = 1000)
Local $retVal = 0, $ex = False
If Not WinExists('[CLASS:Volume Control]') Then
Run('sndvol32', '', @SW_HIDE)
$ex = True
EndIf
If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1
$retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked')
If @error Then Return -2
If $retVal Then
ControlCommand('[CLASS:Volume Control]', '', $opt, 'UnCheck')
If @error Then Return -2
Else
ControlCommand('[CLASS:Volume Control]', '', $opt, 'Check')
If @error Then Return -2
EndIf
If $ex = True Then WinClose('[CLASS:Volume Control]')
Return
EndFunc ;==>_ToggleMuteMaster