Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'GetCapture' and 'MapWindowPoints' functions to user32.go #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions user32.go
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,7 @@ var (
findWindow *windows.LazyProc
getActiveWindow *windows.LazyProc
getAncestor *windows.LazyProc
getCapture *windows.LazyProc
getCaretPos *windows.LazyProc
getClassName *windows.LazyProc
getClientRect *windows.LazyProc
Expand Down Expand Up @@ -1845,6 +1846,7 @@ var (
loadImage *windows.LazyProc
loadMenu *windows.LazyProc
loadString *windows.LazyProc
mapWindowPoints *windows.LazyProc
messageBeep *windows.LazyProc
messageBox *windows.LazyProc
monitorFromWindow *windows.LazyProc
Expand Down Expand Up @@ -1945,6 +1947,7 @@ func init() {
findWindow = libuser32.NewProc("FindWindowW")
getActiveWindow = libuser32.NewProc("GetActiveWindow")
getAncestor = libuser32.NewProc("GetAncestor")
getCapture = libuser32.NewProc("GetCapture")
getCaretPos = libuser32.NewProc("GetCaretPos")
getClassName = libuser32.NewProc("GetClassNameW")
getClientRect = libuser32.NewProc("GetClientRect")
Expand Down Expand Up @@ -2000,6 +2003,7 @@ func init() {
loadImage = libuser32.NewProc("LoadImageW")
loadMenu = libuser32.NewProc("LoadMenuW")
loadString = libuser32.NewProc("LoadStringW")
mapWindowPoints = libuser32.NewProc("MapWindowPoints")
messageBeep = libuser32.NewProc("MessageBeep")
messageBox = libuser32.NewProc("MessageBoxW")
monitorFromWindow = libuser32.NewProc("MonitorFromWindow")
Expand Down Expand Up @@ -2464,6 +2468,14 @@ func GetAncestor(hWnd HWND, gaFlags uint32) HWND {
return HWND(ret)
}

func GetCapture() HWND {
ret, _, _ := syscall.Syscall(getCapture.Addr(), 0,
0,
0,
0)
return HWND(ret)
}

func GetCaretPos(lpPoint *POINT) bool {
ret, _, _ := syscall.Syscall(getCaretPos.Addr(), 1,
uintptr(unsafe.Pointer(lpPoint)),
Expand Down Expand Up @@ -2935,6 +2947,18 @@ func LoadString(instRes HINSTANCE, id uint32, buf *uint16, length int32) int32 {
return int32(ret)
}

func MapWindowPoints(hWndFrom, hWndTo HWND, lpPoints *POINT, cPoints uint32) int32 {
ret, _, _ := syscall.Syscall6(mapWindowPoints.Addr(), 4,
uintptr(hWndFrom),
uintptr(hWndTo),
uintptr(unsafe.Pointer(lpPoints)),
uintptr(cPoints),
0,
0)

return int32(ret)
}

// Plays a waveform sound. uType is the sound to be played. The sounds are set by the user through the Sound control panel application.
// The following values can be used as a sound:
//
Expand Down