Commit 6f219e85 authored by Amos Wenger's avatar Amos Wenger

Add GetWIndowLongPtr, IsWindowVisible

parent aaa04cc8
Pipeline #11880 passed with stage
in 24 seconds
...@@ -14,6 +14,24 @@ var ( ...@@ -14,6 +14,24 @@ var (
procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
procSetForegroundWindow = moduser32.NewProc("SetForegroundWindow") procSetForegroundWindow = moduser32.NewProc("SetForegroundWindow")
procShowWindow = moduser32.NewProc("ShowWindow") procShowWindow = moduser32.NewProc("ShowWindow")
procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
procGetWindowLongPtr = moduser32.NewProc("GetWindowLongPtr")
)
// GetWindowLong and GetWindowLongPtr constants
const (
GWL_EXSTYLE = -20
GWL_STYLE = -16
GWL_WNDPROC = -4
GWLP_WNDPROC = -4
GWL_HINSTANCE = -6
GWLP_HINSTANCE = -6
GWL_HWNDPARENT = -8
GWLP_HWNDPARENT = -8
GWL_ID = -12
GWLP_ID = -12
GWL_USERDATA = -21
GWLP_USERDATA = -21
) )
func EnumWindows( func EnumWindows(
...@@ -91,3 +109,32 @@ func ShowWindow( ...@@ -91,3 +109,32 @@ func ShowWindow(
} }
return return
} }
func IsWindowVisible(
hwnd syscall.Handle,
) bool {
ret, _, _ := syscall.Syscall(
procGetWindowLongPtr.Addr(),
1,
uintptr(hwnd),
0,
0,
)
return ret != 0
}
func GetWindowLongPtr(
hwnd syscall.Handle,
index int32,
) uintptr {
ret, _, _ := syscall.Syscall(
procGetWindowLongPtr.Addr(),
2,
uintptr(hwnd),
uintptr(index),
0,
)
return ret
}
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