Page 1 of 2
Hide/show taskbar in Windows 10
Posted: 09 Jan 2019, 16:19
by AmDeG 11
at this script I was able to hide/show the taskbar in Windows 10
it works but not always
anyone has something better?
Code: Select all
RAlt & LWin:: ;hide/unhide taskbar (toogle)
Run control.exe /name Microsoft.Taskbar
WinWait ahk_class ApplicationFrameWindow
WinRestore ahk_class ApplicationFrameWindow
WinMaximize ahk_class ApplicationFrameWindow
Sleep, 800
Send {Back}{Tab 3}
Sleep 1000
Send {Space}
Sleep 800
Send !{F4}
return
Re: Hide/show taskbar in Windows 10
Posted: 09 Jan 2019, 18:26
by teadrinker
Try this:
Code: Select all
$F12:: HideShowTaskbar(hide := !hide)
HideShowTaskbar(action) {
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)
}
Re: Hide/show taskbar in Windows 10
Posted: 09 Jan 2019, 18:54
by AmDeG 11
superb!
however I cannot take advantage of the lower part when the task bar is hidden
In the past, in order to command a window to become half screen I had to determine the specific area (if not was not always doing directly that):
Code: Select all
#z:: ;; right half screen
WinGet, active_id, ID, A
WinGet, MinMaxState, MinMax, ahk_id %active_id%
if (MinMaxState = 1)
WinRestore, ahk_id %active_id%
WinMove ahk_id %active_id%,,1920,0,1920,2100
WinActivate
Return
is there a way to include that when the taskbar is hidden the Height of this window reaches to 2171 ?
Re: Hide/show taskbar in Windows 10
Posted: 10 Jan 2019, 11:54
by teadrinker
I'm not sure, what is the problem:
Code: Select all
#z::
WinWait, A
WinGet, MinMax, MinMax
if MinMax
WinRestore
WinGetPos,, Y,,, ahk_class Shell_TrayWnd
WinMove,,, A_ScreenWidth//2, 0, A_ScreenWidth//2, Y
Return
?
Re: Hide/show taskbar in Windows 10
Posted: 10 Jan 2019, 15:36
by AmDeG 11
good
it works ok though it does not get to very right border and bottom
what would it be the difference a the WinMove line to a similar script for the left half side?
Re: Hide/show taskbar in Windows 10
Posted: 10 Jan 2019, 21:23
by teadrinker
Code: Select all
#z::
#x::
hWnd := WinExist("A")
WinGet, MinMax, MinMax
if MinMax
WinRestore
WinGetPos,, Y_TaskBar,,, ahk_class Shell_TrayWnd
dX := dW := dH := 0
VarSetCapacity(RECT, 16, 0)
if DllCall("Dwmapi\DwmGetWindowAttribute", Ptr, hWnd, UInt, DWMWA_EXTENDED_FRAME_BOUNDS := 9, Ptr, &RECT, UInt, 16) = 0 {
WinGetPos, X, Y, W, H
dX := NumGet(RECT, "Int") - X
dW := X + W - NumGet(RECT, 8, "Int") + dX
dH := Y + H - NumGet(RECT, 12, "Int")
}
WinMove,,, (A_ThisHotkey = "#z" ? 0 : A_ScreenWidth//2) - dX, 0, A_ScreenWidth//2 + dW, Y_TaskBar + dH
Return
Win + Z left side, Win + X right side.
Re: Hide/show taskbar in Windows 10
Posted: 11 Jan 2019, 10:39
by AmDeG 11
all solved - you understood perfectly well my concern
absolutely great
thanks so much !
Re: Hide/show taskbar in Windows 10
Posted: 16 Feb 2021, 14:07
by JoeWinograd
teadrinker wrote:Try this
W10 Pro 64-bit v20H2
AHK 1.1.33.02 U64
Hi teadrinker,
I'm using this code from your earlier post:
Code: Select all
HideShowTaskbar(action) {
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)
}
A call to
HideShowTaskbar("ABS_AUTOHIDE") works perfectly, auto-hiding the taskbar. However, a subsequent call to
HideShowTaskbar("ABS_ALWAYSONTOP") does not work, i.e., the taskbar remains in auto-hide state. Does it work for you? Thanks, Joe
Re: Hide/show taskbar in Windows 10
Posted: 16 Feb 2021, 14:53
by teadrinker
Hi Joe
Use HideShowTaskbar(true) to hide the taskbar, HideShowTaskbar(false) to show.
Re: Hide/show taskbar in Windows 10
Posted: 16 Feb 2021, 15:39
by JoeWinograd
Hi teadrinker,
I obviously misunderstood the parameter to the function...my bad. The calls with True and False work perfectly! Thanks much! Stay safe, Joe
Re: Hide/show taskbar in Windows 10
Posted: 08 Aug 2021, 19:48
by milkygirl90
teadrinker wrote: ↑09 Jan 2019, 18:26
Try this:
Code: Select all
$F12:: HideShowTaskbar(hide := !hide)
HideShowTaskbar(action) {
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)
}
Hi! Came across your awesome script and just wanted to say thank you. Would like to ask, is it possible to eliminate the "slide away" animation and make it immediately appear/hide instead?
In addition, how do I disable taskbar from showing when hovering over taskbar area? I just want to show/hide using hotkeys instea.
Re: Hide/show taskbar in Windows 10
Posted: 08 Aug 2021, 20:00
by teadrinker
Hi,
I'll take a look at it tomorrow.
Re: Hide/show taskbar in Windows 10
Posted: 09 Aug 2021, 08:50
by teadrinker
milkygirl90 wrote: ↑is it possible to eliminate the "slide away" animation and make it immediately appear/hide instead?
In addition, how do I disable taskbar from showing when hovering over taskbar area? I just want to show/hide using hotkeys instea.
No, unfortunately, I've not found such capabilities in this api.
Re: Hide/show taskbar in Windows 10
Posted: 09 Aug 2021, 17:02
by malcev
Re: Hide/show taskbar in Windows 10
Posted: 10 Aug 2021, 01:59
by teadrinker
If I were OP, I'd ask you to write the complete code.
Re: Hide/show taskbar in Windows 10
Posted: 10 Aug 2021, 07:18
by malcev
)
Code: Select all
$F12:: HideShowTaskbar(hide := !hide)
HideShowTaskbar(action)
{
if action
WinHide, ahk_class Shell_TrayWnd
else
WinShow, ahk_class Shell_TrayWnd
}
Re: Hide/show taskbar in Windows 10
Posted: 10 Aug 2021, 12:58
by teadrinker
Assuming 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
}
}
Re: Hide/show taskbar in Windows 10
Posted: 10 Aug 2021, 13:44
by malcev
If user has custom toolbars - then better to use SPI_GETWORKAREA before SPI_SETWORKAREA.
Re: Hide/show taskbar in Windows 10
Posted: 10 Aug 2021, 13:50
by teadrinker
I've thought about it, but what if the script starts when the workarea has already been changed?
Re: Hide/show taskbar in Windows 10
Posted: 31 Aug 2021, 08:37
by shuq
@
AmDeG 11 wrote:
at this script I was able to hide/show the taskbar in Windows 10
it works but not always
anyone has something better?
Code: Select all
RAlt & LWin:: ;hide/unhide taskbar (toogle)
Run control.exe /name Microsoft.Taskbar
WinWait ahk_class ApplicationFrameWindow
WinRestore ahk_class ApplicationFrameWindow
WinMaximize ahk_class ApplicationFrameWindow
Sleep, 800
Send {Back}{Tab 3}
Sleep 1000
Send {Space}
Sleep 800
Send !{F4}
return
Thanks, the code helps a lot