This works very well, but how can I disable taskbar on second window as well? It works only half way, both taskbars disappear but only SecondayyTrayWnd appear back, TrayWnd appears and disappears instantlyteadrinker wrote: ↑10 Aug 2021, 12:58Assuming the taskbar is at the bottom of the screen, this should work:Code: Select all
$F12:: HideShowTaskbar() HideShowTaskbar() { static SW_HIDE := 0, SW_SHOWNA := 8, SPI_SETWORKAREA := 0x2F DetectHiddenWindows, On hTB := WinExist("ahk_class Shell_TrayWnd") WinGetPos,,,, H hBT := WinExist("ahk_class Button ahk_exe Explorer.EXE") ; for Windows 7 b := DllCall("IsWindowVisible", "Ptr", hTB) for k, v in [hTB, hBT] ( v && DllCall("ShowWindow", "Ptr", v, "Int", b ? SW_HIDE : SW_SHOWNA) ) VarSetCapacity(RECT, 16, 0) NumPut(A_ScreenWidth, RECT, 8) NumPut(A_ScreenHeight - !b*H, RECT, 12, "UInt") DllCall("SystemParametersInfo", "UInt", SPI_SETWORKAREA, "UInt", 0, "Ptr", &RECT, "UInt", 0) WinGet, List, List Loop % List { WinGet, res, MinMax, % "ahk_id" . List%A_Index% if (res = 1) WinMove, % "ahk_id" . List%A_Index%,, 0, 0, A_ScreenWidth, A_ScreenHeight - !b*H } }
Code: Select all
$F12:: HideBoth(hide := !hide)
HideBoth(action) {
HideShowTaskbar("Shell_TrayWnd", action)
HideShowTaskbar("Shell_SecondaryTrayWnd", action)
}
HideShowTaskbar(TaskShell,action) {
static SW_HIDE := 0, SW_SHOWNA := 8, SPI_SETWORKAREA := 0x2F
DetectHiddenWindows, On
hTB := WinExist("ahk_class " . TaskShell)
WinGetPos,,,, H
b := DllCall("IsWindowVisible", "Ptr", hTB)
DllCall("ShowWindow", "Ptr", hTB, "Int", action ? SW_HIDE : SW_SHOWNA)
VarSetCapacity(RECT, 16, 0)
NumPut(A_ScreenWidth, RECT, 8)
NumPut(A_ScreenHeight - !b*H, RECT, 12, "UInt")
DllCall("SystemParametersInfo", "UInt", SPI_SETWORKAREA, "UInt", 0, "Ptr", &RECT, "UInt", 0)
WinGet, List, List
Loop % List {
WinGet, res, MinMax, % "ahk_id" . List%A_Index%
if (res = 1)
WinMove, % "ahk_id" . List%A_Index%,, 0, 0, A_ScreenWidth, A_ScreenHeight - !b*H
}
}
I have this code that works well on both screens, but I am trying other variants aswell
Code: Select all
hide := true
; HideShowTaskbar(true)
^!U:: HideShowTaskbar(hide := !hide)
HideShowTaskbar(action) {
; MsgBox, done
static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA)
if(action = true)
{
WinSet, Transparent, 0, ahk_class Shell_TrayWnd
WinSet, Transparent, 0, ahk_class Shell_SecondaryTrayWnd
}
else {
WinSet, Transparent, 255, ahk_class Shell_TrayWnd
WinSet, TransColor, OFF, ahk_class Shell_TrayWnd
WinSet, Transparent, OFF, ahk_class Shell_TrayWnd
WinSet, Redraw,, ahk_class Shell_TrayWnd
WinSet, Transparent, 255, ahk_class Shell_SecondaryTrayWnd
WinSet, TransColor, OFF, ahk_class Shell_SecondaryTrayWnd
WinSet, Transparent, OFF, ahk_class Shell_SecondaryTrayWnd
WinSet, Redraw,, ahk_class Shell_SecondaryTrayWnd
}
}