首页 > 其他分享 >[AHK2] 音量控制

[AHK2] 音量控制

时间:2023-07-09 13:47:11浏览次数:53  
标签:APPCOMMAND AHK2 VOLUME static UInt TYPE 音量控制 SetVolume

  • 最简单的方式-使用ahk API
^XButton2:: Send "{Volume_Up}"
^XButton1:: Send "{Volume_Down}"
  • 使用DllCall
^Ins:: SetVolume("Up")
^Del:: SetVolume("Down")
^PrintScreen:: SetVolume("Mute")

SetVolume(LPARAM) {
    static WM_APPCOMMAND := 0x319
    static APPCOMMAND_VOLUME_MUTE := 0x80000
    static APPCOMMAND_VOLUME_UP := 0xA0000
    static APPCOMMAND_VOLUME_DOWN := 0x90000

    switch LPARAM {
        case "Up": APPCOMMAND_VOLUME_TYPE := APPCOMMAND_VOLUME_UP
        case "Down": APPCOMMAND_VOLUME_TYPE := APPCOMMAND_VOLUME_DOWN
        case "Mute": APPCOMMAND_VOLUME_TYPE := APPCOMMAND_VOLUME_MUTE
    }
    HWorkerW := WinGetID("ahk_class WorkerW")
    DllCall("SendMessage", "UInt", HWorkerW, "UInt", WM_APPCOMMAND, "UInt", 0, "UInt", APPCOMMAND_VOLUME_TYPE)
}

标签:APPCOMMAND,AHK2,VOLUME,static,UInt,TYPE,音量控制,SetVolume
From: https://www.cnblogs.com/refiz/p/17538622.html

相关文章

  • [AHK2] 轻松拖拽窗口
    使用:非最大化下,按住ctrlalt鼠标左键拖动如下:*<^<!LButton::{CoordMode"Mouse","Screen"MouseGetPos(&px,&py)WinGetPos(&wx,&wy,,,'A')dx:=wx-px,dy:=wy-pySetWinDelay-1WhileGet......