Commit 327501e0 authored by Amos Wenger's avatar Amos Wenger

Add SwitchToThisWindow

parent ed04a604
Pipeline #11883 passed with stage
in 25 seconds
......@@ -15,6 +15,7 @@ var (
procSetForegroundWindow = moduser32.NewProc("SetForegroundWindow")
procShowWindow = moduser32.NewProc("ShowWindow")
procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
procSwitchToThisWindow = moduser32.NewProc("SwitchToThisWindow")
)
func EnumWindows(
......@@ -106,3 +107,21 @@ func IsWindowVisible(
return ret != 0
}
func SwitchToThisWindow(
hwnd syscall.Handle,
altTab bool,
) {
altTabInt := 0
if altTab {
altTabInt = 1
}
syscall.Syscall(
procSwitchToThisWindow.Addr(),
2,
uintptr(hwnd),
uintptr(altTabInt),
0,
)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment