hide from task bar

This commit is contained in:
KingKDot
2026-07-12 15:12:31 -05:00
parent 082716081e
commit 26702510eb
2 changed files with 11 additions and 0 deletions
@@ -49,6 +49,8 @@ var (
procGetWindowThreadProcessId = user32.NewProc("GetWindowThreadProcessId")
procEnumDesktopWindows = user32.NewProc("EnumDesktopWindows")
procTerminateProcess = kernel32.NewProc("TerminateProcess")
procGetWindowLongPtrW = user32.NewProc("GetWindowLongPtrW")
procSetWindowLongPtrW = user32.NewProc("SetWindowLongPtrW")
)
const (
@@ -144,6 +146,9 @@ const (
SW_SHOWMAXIMIZED = 3
GA_ROOT = 2
SMTO_ABORTIFHUNG = 0x0002
GWL_EXSTYLE = -20
WS_EX_TOOLWINDOW = 0x00000080
)
var (
@@ -851,6 +851,12 @@ func moveProcessWindowsToVirtualMonitor(pid uint32, bounds image.Rectangle, base
procSetWindowPos.Call(hwnd, 0, uintptr(newX), uintptr(newY), uintptr(winW), uintptr(winH), flags)
hwndMap[hwnd] = visible
gwlExStyle := int(GWL_EXSTYLE)
exStyle, _, _ := procGetWindowLongPtrW.Call(hwnd, uintptr(gwlExStyle))
if exStyle != 0 {
procSetWindowLongPtrW.Call(hwnd, uintptr(gwlExStyle), exStyle|WS_EX_TOOLWINDOW)
}
log.Printf("virtual: moved window hwnd=0x%x (pid=%d) to virtual monitor (%d,%d)", hwnd, pid, bounds.Min.X, bounds.Min.Y)
moved++
break