-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathShowHideTaskbar.ahk
59 lines (45 loc) · 1.23 KB
/
ShowHideTaskbar.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ShowHideTaskbar(ByRef fnShowTaskbar := 0)
{
; Hides or reveals the windows taskbar
; MsgBox fnShowTaskbar: %fnShowTaskbar%
; declare local, global, static variables
Try
{
; set default return value
ReturnValue := 0 ; success
; validate parameters
If fnShowTaskbar not in 0,1
Throw, Exception("fnShowTaskbar not in 0,1")
; initialise variables
; show or hide taskbar
If fnShowTaskbar
{
NumPut((ABS_ALWAYSONTOP := 0x2),APPBARDATA,32,"UInt")
DllCall("Shell32.dll\SHAppBarMessage","UInt",(ABM_SETSTATE := 0xA),"UInt",&APPBARDATA)
WinShow, ahk_class Shell_TrayWnd
}
If !fnShowTaskbar
{
DetectHiddenWindows, On
VarSetCapacity(APPBARDATA,36,0)
NumPut((ABS_ALWAYSONTOP := 0x2)|(ABS_AUTOHIDE := 0x1),APPBARDATA,32,"UInt")
DllCall("Shell32.dll\SHAppBarMessage","UInt",(ABM_SETSTATE := 0xA),"UInt",&APPBARDATA)
Sleep, 10
WinHide, ahk_class Shell_TrayWnd
}
}
Catch, ThrownValue
{
ReturnValue := !ReturnValue
CatchHandler(A_ThisFunc,ThrownValue.Message,ThrownValue.What,ThrownValue.Extra,ThrownValue.File,ThrownValue.Line,0,0,0)
}
Finally
{
}
; return
Return ReturnValue
}
/* ; testing
ReturnValue := ShowHideTaskbar(0)
MsgBox, ShowHideTaskbar`n`nReturnValue: %ReturnValue%
*/