hide from task bar
This commit is contained in:
@@ -49,6 +49,8 @@ var (
|
|||||||
procGetWindowThreadProcessId = user32.NewProc("GetWindowThreadProcessId")
|
procGetWindowThreadProcessId = user32.NewProc("GetWindowThreadProcessId")
|
||||||
procEnumDesktopWindows = user32.NewProc("EnumDesktopWindows")
|
procEnumDesktopWindows = user32.NewProc("EnumDesktopWindows")
|
||||||
procTerminateProcess = kernel32.NewProc("TerminateProcess")
|
procTerminateProcess = kernel32.NewProc("TerminateProcess")
|
||||||
|
procGetWindowLongPtrW = user32.NewProc("GetWindowLongPtrW")
|
||||||
|
procSetWindowLongPtrW = user32.NewProc("SetWindowLongPtrW")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -144,6 +146,9 @@ const (
|
|||||||
SW_SHOWMAXIMIZED = 3
|
SW_SHOWMAXIMIZED = 3
|
||||||
GA_ROOT = 2
|
GA_ROOT = 2
|
||||||
SMTO_ABORTIFHUNG = 0x0002
|
SMTO_ABORTIFHUNG = 0x0002
|
||||||
|
|
||||||
|
GWL_EXSTYLE = -20
|
||||||
|
WS_EX_TOOLWINDOW = 0x00000080
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
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)
|
procSetWindowPos.Call(hwnd, 0, uintptr(newX), uintptr(newY), uintptr(winW), uintptr(winH), flags)
|
||||||
hwndMap[hwnd] = visible
|
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)
|
log.Printf("virtual: moved window hwnd=0x%x (pid=%d) to virtual monitor (%d,%d)", hwnd, pid, bounds.Min.X, bounds.Min.Y)
|
||||||
moved++
|
moved++
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user