显示隐藏整个任务栏
#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