System volume control tool – Change volume with mouse wheel

In Windows 11 version 2H22, you can now change the volume by hovering the mouse cursor over the sound icon and rolling the mouse wheel up or down.

However, there was an issue where the taskbar would be hidden when viewing videos such as YouTube in full screen, making this convenient feature unusable.

So this time, I created a tool called "MW_VOLUME" using Autoit that allows you to adjust the volume even in full-screen mode.

MW_VOLUME features:

  • Compatible with 64-bit Windows 10/11
  • Volume can be adjusted even in full screen mode
  • simple operation
  • Open Source
table of contents

Volume change tool screen

The tool is very small and displays in the bottom right corner of the screen (above the taskbar).

Taskbar
Taskbar

Place the mouse cursor over the tool, and when the cursor changes to a hand, roll the mouse wheel up to increase the volume or down to decrease the volume.

※ToolsActiveIf it is no longer displayed, you will not be able to change the volume. In this case, click the tool once and then turn the mouse wheel.

In Windows 10, when you change the volume, the volume level is displayed in the top left corner of the screen.

Windows 10 volume display
Windows 10 volume display

In Windows 11, the volume level is displayed at the bottom center of the screen.

Windows 11 volume display
Windows 11 volume display

How the volume change tool works and its code

How the volume change tool works

To increase or decrease the volume, the tool monitors the mouse wheel movement on the tool, and sends a volume increase message to the window handle "SHELLDLL_DefView" when the wheel is turned up, and a volume decrease message when the wheel is turned down.

*This works in the same way as changing the volume using keyboard shortcuts.

It is always displayed at the top of the screen, so you can change the volume while watching YouTube etc. in full screen.

You can also drag the tool itself with the mouse to move it where it is easiest to use.

To return it to its original position, right-click the tool and click "Return to top of taskbar."

This tool does not display an icon on the taskbar, so if you want to close the tool, right-click it and click "Close" to exit.

Volume change tool code

2023/3/14: Code corrections have been made. (Ver 1.0.0.3)

Before modification

Global $hwnd = ControlGetHandle('[CLASS:Progman]', '', '[CLASS:SHELLDLL_DefView]')

After correction

Global $hwnd = ControlGetHandle('[CLASS:Progman]', '', '')

MW_VOLUME :

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=SndVol_0_1.ico
#AutoIt3Wrapper_Outfile_x64=MW_VOLUME.exe
#AutoIt3Wrapper_Res_Description=マウスホイールでシステム音量を変更
#AutoIt3Wrapper_Res_Fileversion=1.0.0.3
#AutoIt3Wrapper_Res_ProductName=MW_VOLUME
#AutoIt3Wrapper_Res_ProductVersion=1.3
#AutoIt3Wrapper_Res_CompanyName=©2022 wenbang https://windows-waza.com/
#AutoIt3Wrapper_Res_LegalCopyright=©2022 wenbang https://windows-waza.com/
#AutoIt3Wrapper_Res_LegalTradeMarks=MW_VOLUME.exe
#AutoIt3Wrapper_Res_Language=1041
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPIProc.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include-once

If Not FileExists(@ScriptDir & "\Image\SndVol.bmp") Then; 画像ファイルが見つからない場合プログラムを終了します。
    MsgBox(48, " MW_VOLUME - エラー", "必要なファイルが見つかりません。プログラムを終了します。")
    Exit
EndIf

If _Singleton(" MW_VOLUME", 1) = 0 Then Exit; プログラムの二重起動を抑止

DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext", "HWND", "DPI_AWARENESS_CONTEXT" - 2); 高 DPI に対応

Opt("TrayIconHide", 1); トレイアイコンを非表示

Global $hwnd = ControlGetHandle('[CLASS:Progman]', '', '')
Global $APPCOMMAND_VOLUME_UP = 0xA0000;
Global $APPCOMMAND_VOLUME_DOWN = 0x90000;
;~ Global $APPCOMMAND_VOLUME_MUTE = 0x80000;
Global $Xpos, $Ypos

; ウィンドウの大きさ
$Width = 25
$Hight = 25

_GetTaskbarPosition()

$Form = GUICreate(" MW_VOLUME", $Width, $Hight, $Xpos, $Ypos, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetBkColor(0x000000)
GUISetCursor(0, 1)

; $GUI_WS_EX_PARENTDRAG を指定することで、画像をドラッグしてウィンドウの移動を可能にする。
$Icon = GUICtrlCreatePic(@ScriptDir & "\Image\SndVol.bmp", 2, 2, 23, 23, -1, $GUI_WS_EX_PARENTDRAG)

$Menu = GUICtrlCreateContextMenu($Icon); サウンドアイコンの右クリックにメニューを追加
$MoveToTaskBar = GUICtrlCreateMenuItem("タスクバーの上に戻る", $Menu)
GUICtrlCreateMenuItem("", $Menu)
$help = GUICtrlCreateMenuItem("WEBサイトへ", $Menu)
$exit = GUICtrlCreateMenuItem("終了", $Menu)
GUISetState()

_WinAPI_EmptyWorkingSet()

; ウィンドウの上でマウスホイールを回したかどうかを監視
GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")

While 1
    $nMSG = GUIGetMsg()
    Switch $nMSG
        Case $GUI_EVENT_CLOSE, $exit
            Exit
        Case $MoveToTaskBar
            _GetTaskbarPosition(); 解像度やタスクバーのサイズが変更された時のためにタスクバーの位置を再度取得します。
            WinMove($Form, "", $Xpos, $Ypos)
        Case $help
            ShellExecute("https://windows-waza.com/")
    EndSwitch
WEnd

Func WM_MOUSEWHEEL($hWndGUI, $MsgID, $WParam)
    If BitShift($wParam, 16) > 0 Then ; マウスホイールが上に回された
        ; 音量アップ
        _SendMessage($hwnd, $WM_APPCOMMAND, 0x200eb0, $APPCOMMAND_VOLUME_UP)
    Else ; マウスホイールが下に回された
        ; 音量ダウン
        _SendMessage($hwnd, $WM_APPCOMMAND, 0x200eb0, $APPCOMMAND_VOLUME_DOWN)
    EndIf
EndFunc   ;==>WM_MOUSEWHEEL

Func _GetTaskbarPosition()
    ; タスクバーの位置を取得し、メインウィンドウの位置をタスクバーの右上にする
    $TaskBar = WinGetPos("[class:Shell_TrayWnd]")
    If Not @error Then
        $Xpos = @DesktopWidth - $Width
        $Ypos = @DesktopHeight - $Hight - $TaskBar[3]
    EndIf
EndFunc   ;==>_GetTaskbarPosition

update information

2022/10/04 Ver.1.0.0.0 Released
2022/12/17 Ver.1.0.0.2 Released

1. Changed to allow windows to be moved.

2. Added "Return to top of taskbar" to the right-click menu.

Tool right-click menu
Tool right-click menu

3. The volume display on the window has been removed.

2023/3/14 Ver.1.0.0.3 Released

1. Fixed an issue where the volume could not be changed in some environments.

Download the volume change tool "MW_VOLUME" Ver 1.0.0.3

* Regarding use of the software (please read carefully)

MW_VOLUM(Vector)

If you found this article helpful, please share it on social media.

Person who wrote this article

Driven by questions arising from my daily PC use and the desire to "do more," I have been pursuing self-study in Windows since around 2008. I am sharing the "aha!" techniques and solutions I discovered through trial and error with the sole purpose of helping you in your PC life.

View profile

Comment:

To comment

[About submissions]
We welcome any questions or information regarding the content of the article.
However, please note that content unrelated to the purpose of the article, criticism of specific individuals or organizations, offensive language,Inappropriate wordsComments containing the above may be deleted or made private without notice at the discretion of the administrator.
Please note that spam may be automatically deleted by anti-spam measures.

CAPTCHA


table of contents