|
|
@ -444,9 +444,18 @@ var (
|
|
|
|
procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW")
|
|
|
|
procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW")
|
|
|
|
procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath")
|
|
|
|
procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath")
|
|
|
|
procShellExecuteW = modshell32.NewProc("ShellExecuteW")
|
|
|
|
procShellExecuteW = modshell32.NewProc("ShellExecuteW")
|
|
|
|
|
|
|
|
procEnumChildWindows = moduser32.NewProc("EnumChildWindows")
|
|
|
|
|
|
|
|
procEnumWindows = moduser32.NewProc("EnumWindows")
|
|
|
|
procExitWindowsEx = moduser32.NewProc("ExitWindowsEx")
|
|
|
|
procExitWindowsEx = moduser32.NewProc("ExitWindowsEx")
|
|
|
|
|
|
|
|
procGetClassNameW = moduser32.NewProc("GetClassNameW")
|
|
|
|
|
|
|
|
procGetDesktopWindow = moduser32.NewProc("GetDesktopWindow")
|
|
|
|
|
|
|
|
procGetForegroundWindow = moduser32.NewProc("GetForegroundWindow")
|
|
|
|
|
|
|
|
procGetGUIThreadInfo = moduser32.NewProc("GetGUIThreadInfo")
|
|
|
|
procGetShellWindow = moduser32.NewProc("GetShellWindow")
|
|
|
|
procGetShellWindow = moduser32.NewProc("GetShellWindow")
|
|
|
|
procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
|
|
|
|
procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
|
|
|
|
|
|
|
|
procIsWindow = moduser32.NewProc("IsWindow")
|
|
|
|
|
|
|
|
procIsWindowUnicode = moduser32.NewProc("IsWindowUnicode")
|
|
|
|
|
|
|
|
procIsWindowVisible = moduser32.NewProc("IsWindowVisible")
|
|
|
|
procMessageBoxW = moduser32.NewProc("MessageBoxW")
|
|
|
|
procMessageBoxW = moduser32.NewProc("MessageBoxW")
|
|
|
|
procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
|
|
|
|
procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
|
|
|
|
procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
|
|
|
|
procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
|
|
|
@ -3802,6 +3811,19 @@ func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *ui
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) {
|
|
|
|
|
|
|
|
syscall.Syscall(procEnumChildWindows.Addr(), 3, uintptr(hwnd), uintptr(enumFunc), uintptr(param))
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) {
|
|
|
|
|
|
|
|
r1, _, e1 := syscall.Syscall(procEnumWindows.Addr(), 2, uintptr(enumFunc), uintptr(param), 0)
|
|
|
|
|
|
|
|
if r1 == 0 {
|
|
|
|
|
|
|
|
err = errnoErr(e1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func ExitWindowsEx(flags uint32, reason uint32) (err error) {
|
|
|
|
func ExitWindowsEx(flags uint32, reason uint32) (err error) {
|
|
|
|
r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
|
|
|
|
r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
|
|
|
|
if r1 == 0 {
|
|
|
|
if r1 == 0 {
|
|
|
@ -3810,6 +3832,35 @@ func ExitWindowsEx(flags uint32, reason uint32) (err error) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) {
|
|
|
|
|
|
|
|
r0, _, e1 := syscall.Syscall(procGetClassNameW.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount))
|
|
|
|
|
|
|
|
copied = int32(r0)
|
|
|
|
|
|
|
|
if copied == 0 {
|
|
|
|
|
|
|
|
err = errnoErr(e1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func GetDesktopWindow() (hwnd HWND) {
|
|
|
|
|
|
|
|
r0, _, _ := syscall.Syscall(procGetDesktopWindow.Addr(), 0, 0, 0, 0)
|
|
|
|
|
|
|
|
hwnd = HWND(r0)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func GetForegroundWindow() (hwnd HWND) {
|
|
|
|
|
|
|
|
r0, _, _ := syscall.Syscall(procGetForegroundWindow.Addr(), 0, 0, 0, 0)
|
|
|
|
|
|
|
|
hwnd = HWND(r0)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) {
|
|
|
|
|
|
|
|
r1, _, e1 := syscall.Syscall(procGetGUIThreadInfo.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(info)), 0)
|
|
|
|
|
|
|
|
if r1 == 0 {
|
|
|
|
|
|
|
|
err = errnoErr(e1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func GetShellWindow() (shellWindow HWND) {
|
|
|
|
func GetShellWindow() (shellWindow HWND) {
|
|
|
|
r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
|
|
|
|
r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
|
|
|
|
shellWindow = HWND(r0)
|
|
|
|
shellWindow = HWND(r0)
|
|
|
@ -3825,6 +3876,24 @@ func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func IsWindow(hwnd HWND) (isWindow bool) {
|
|
|
|
|
|
|
|
r0, _, _ := syscall.Syscall(procIsWindow.Addr(), 1, uintptr(hwnd), 0, 0)
|
|
|
|
|
|
|
|
isWindow = r0 != 0
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func IsWindowUnicode(hwnd HWND) (isUnicode bool) {
|
|
|
|
|
|
|
|
r0, _, _ := syscall.Syscall(procIsWindowUnicode.Addr(), 1, uintptr(hwnd), 0, 0)
|
|
|
|
|
|
|
|
isUnicode = r0 != 0
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func IsWindowVisible(hwnd HWND) (isVisible bool) {
|
|
|
|
|
|
|
|
r0, _, _ := syscall.Syscall(procIsWindowVisible.Addr(), 1, uintptr(hwnd), 0, 0)
|
|
|
|
|
|
|
|
isVisible = r0 != 0
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
|
|
|
|
func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
|
|
|
|
r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
|
|
|
|
r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
|
|
|
|
ret = int32(r0)
|
|
|
|
ret = int32(r0)
|
|
|
|