[AHK]显示隐藏整个任务栏

本文介绍使用AutoHotkey脚本实现Windows任务栏的隐藏与显示功能。通过调用FindWindowEx函数获取任务栏句柄,并利用WinHide及WinShow命令实现任务栏的隐藏与显示。此外,还提供了一个高级版本的脚本,可以切换任务栏的自动隐藏状态并调整其显示行为。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

显示隐藏整个任务栏


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

hw_tray := DllCall( "FindWindowEx", "uint",0, "uint",0, "str","Shell_TrayWnd", "uint",0 )
MsgBox, % hw_tray
WinHide, ahk_id %hw_tray%
MsgBox, 隐藏
WinShow, ahk_id %hw_tray%
MsgBox, 显示
Return   

;~ 简单版
WinHide ahk_class Shell_TrayWnd   ;隐藏任务栏
WinShow ahk_class Shell_TrayWnd  ;显示任务栏

;可以拉伸桌面的版
F8::
VarSetCapacity( APPBARDATA, 36, 0 )
IfWinNotExist, ahk_class Shell_TrayWnd
{
NumPut( (ABS_ALWAYSONTOP := 0x2), APPBARDATA, 32, "UInt" )           ;Enable "Always on top" (& disable auto-hide)
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
WinShow ahk_class Shell_TrayWnd
}
Else
{
NumPut( ( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )            ;Disable "Always on top" (& enable auto-hide to hide Start button)
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
WinHide ahk_class Shell_TrayWnd
}

Return


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值