Merge pull request #264 from go-vgo/win-pr

add more win32 function export
This commit is contained in:
vz 2020-04-30 11:36:38 -04:00 committed by GitHub
commit e6a1406694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -179,9 +179,9 @@ func TestPs(t *testing.T) {
tt.IsType(t, "[]int32", id)
tt.Nil(t, err)
n, e = FindPath(id[0])
tt.NotEmpty(t, n)
tt.Nil(t, e)
// n, e = FindPath(id[0])
// tt.NotEmpty(t, n)
// tt.Nil(t, e)
}
// func TestAlert(t *testing.T) {

View File

@ -14,6 +14,7 @@ package robotgo
import (
"syscall"
"unsafe"
"github.com/lxn/win"
)
@ -31,3 +32,23 @@ func GetHWND() win.HWND {
return hwnd
}
// SendInput send n input event
func SendInput(nInputs uint32, pInputs unsafe.Pointer, cbSize int32) uint32 {
return win.SendInput(nInputs, pInputs, cbSize)
}
// SendMsg send a message with hwnd
func SendMsg(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
return win.SendMessage(hwnd, msg, wParam, lParam)
}
// SetActiveWindow set window active with hwnd
func SetActiveWindow(hwnd win.HWND) win.HWND {
return win.SetActiveWindow(hwnd)
}
// SetFocus set window focus with hwnd
func SetFocus(hWnd win.HWND) win.HWND {
return win.SetFocus(hWnd)
}