右键单击Windows 10中带有AutoHotKey的托盘图标
发布时间:2020-12-14 02:28:20 所属栏目:Windows 来源:网络整理
导读:在 Windows 7中,我有一个AutoHotKey脚本,可以自动右键单击托盘图标. #Include %A_Scriptdir%TrayIcon.ahkTrayIcon_Button("CCC.exe","R") 其中使用了FanaticGuru’s post的TrayIcon.ahk库. 这在Windows 7上运行得很好,但不再适用于Windows 10. 有没有办法在
在
Windows 7中,我有一个AutoHotKey脚本,可以自动右键单击托盘图标.
#Include %A_Scriptdir%TrayIcon.ahk TrayIcon_Button("CCC.exe","R") 其中使用了FanaticGuru’s post的TrayIcon.ahk库. 这在Windows 7上运行得很好,但不再适用于Windows 10. 有没有办法在Windows 10上的AutoHotKey脚本中右键单击TrayIcon? 这是库中的TrayIcon_Button函数.我没有张贴整个图书馆,因为它相当长. ; ---------------------------------------------------------------------------------------------------------------------- ; Function .....: TrayIcon_Button ; Description ..: Simulate mouse button click on a tray icon. ; Parameters ...: sExeName - Executable Process Name of tray icon. ; ..............: sButton - Mouse button to simulate (L,M,R). ; ..............: bDouble - True to double click,false to single click. ; ..............: index - Index of tray icon to click if more than one match. ; ---------------------------------------------------------------------------------------------------------------------- TrayIcon_Button(sExeName,sButton := "L",bDouble := false,index := 1) { Setting_A_DetectHiddenWindows := A_DetectHiddenWindows DetectHiddenWindows,On WM_MOUSEMOVE = 0x0200 WM_LBUTTONDOWN = 0x0201 WM_LBUTTONUP = 0x0202 WM_LBUTTONDBLCLK = 0x0203 WM_RBUTTONDOWN = 0x0204 WM_RBUTTONUP = 0x0205 WM_RBUTTONDBLCLK = 0x0206 WM_MBUTTONDOWN = 0x0207 WM_MBUTTONUP = 0x0208 WM_MBUTTONDBLCLK = 0x0209 sButton := "WM_" sButton "BUTTON" oIcons := {} oIcons := TrayIcon_GetInfo(sExeName) msgID := oIcons[index].msgID uID := oIcons[index].uID hWnd := oIcons[index].hWnd if bDouble PostMessage,msgID,uID,%sButton%DBLCLK,ahk_id %hWnd% else { PostMessage,%sButton%DOWN,ahk_id %hWnd% PostMessage,%sButton%UP,ahk_id %hWnd% } DetectHiddenWindows,%Setting_A_DetectHiddenWindows% return } 解决方法
我在Windows 10上测试过它.它不适用于溢出窗口下隐藏的图标,尽管它对于可见图标非常有效.
在TrayIcon_GetInfo()中更新这三行以获得快速解决方案 For key,sTray in ["Shell_TrayWnd","NotifyIconOverflowWindow"] SendMessage,0x418,ToolbarWindow32%idxTB%,ahk_class %sTray% ; TB_BUTTONCOUNT SendMessage,0x417,A_Index - 1,pRB,ahk_class %sTray% ; TB_GETBUTTON 替换它们 For key,sTray in ["NotifyIconOverflowWindow","Shell_TrayWnd"] SendMessage,ToolbarWindow32%key%,ahk_class %sTray% ; TB_GETBUTTON 更新:对于已升级到Windows 1607的优秀用户,它再次被破坏:) 要使其在Windows 10 1607中再次运行,请首先遵循最后的规则.之后用以下内容替换: SendMessage,ahk_class %sTray% ; TB_GETBUTTON 同 if ("Shell_TrayWnd" == sTray) { SendMessage,ahk_class %sTray% ; TB_BUTTONCOUNT } else if ("NotifyIconOverflowWindow" == sTray) { SendMessage,ahk_class %sTray% ; TB_BUTTONCOUNT } if ("Shell_TrayWnd" == sTray) { SendMessage,ahk_class %sTray% ; TB_GETBUTTON } else if ("NotifyIconOverflowWindow" == sTray) { SendMessage,ahk_class %sTray% ; TB_GETBUTTON } 注意:我不认为这些更改中的任何一个都是向后兼容的. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 在Windows和LINUX中创建程序库[C]
- windows – 部署工作站 – 最佳实践?
- 独立Windows .exe与安装程序有什么好处?
- windows-server-2008 – 什么是Hyper-V虚拟映像的良好备份计
- windows-server-2012-r2 – 用户文件夹被重命名为“我的文档
- Win2008 Server配置PHP环境 Win2008 Server配置
- Windows批处理脚本:将所有输出重定向到文件
- 将数据传递到Windows中的电子
- windows-server-2008 – 带有RAID 10 SSD的数据库服务器
- windows-xp – 便宜的恢复丢失的NTFS分区?
推荐文章
站长推荐
- windows – Active Directory密码已过期.如果我将
- windows x64安装与测试redis
- windows缓冲区溢出
- windows-phone-8.1 – Windows phone 8.1 BackPr
- .net – 如何使用Mono.Cecil检查.pdb和.dll文件是
- “系统管理大小”究竟对Windows页面文件意味着什
- .net – 用Windows Forms缩放大图片
- opencv – resizeWindow什么都不做?
- Windows 2000 Server + Net2.0 发生 Failed to a
- windows-server-2008 – Windows AD域名更改的最
热点阅读