-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
39 lines (34 loc) · 886 Bytes
/
main.go
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
package main
import (
"log"
"syscall"
)
func main() {
go WinKeyTrigger()
changeTaskbar()
select {}
}
func changeTaskbar() {
szShellTray, err := syscall.UTF16PtrFromString("Shell_TrayWnd")
if err != nil {
log.Println(err)
}
firstTaskbarHWND := FindWindow(szShellTray, nil) // https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-findwindoww
if !SetWindowCompositionAttribute(firstTaskbarHWND, FLAG_ACCENT, 1) {
log.Println("could not change the taskbar")
}
szShellSecondaryTray, err := syscall.UTF16PtrFromString("Shell_SecondaryTrayWnd")
if err != nil {
log.Println(err)
}
var otherBars = HWND(0)
for {
otherBars = FindWindowEx(0, otherBars, szShellSecondaryTray, nil)
if otherBars == zeroHandle {
break
}
if !SetWindowCompositionAttribute(otherBars, FLAG_ACCENT, 1) {
log.Println("could not change the other taskbar")
}
}
}