Exemplo n.º 1
0
// http://stackoverflow.com/questions/3720968/win32-simulate-a-click-without-simulating-mouse-movement
func MouseClick(hWnd win.HWND, x, y int) {
	var pt win.POINT
	pt.X = int32(x) // This is your click coordinates
	pt.Y = int32(y)

	//hWnd = win.WindowFromPoint(pt)
	lParam := uintptr(win.MAKELONG(uint16(pt.X), uint16(pt.Y)))
	win.PostMessage(hWnd, win.WM_LBUTTONDOWN, win.MK_LBUTTON, lParam)
	win.PostMessage(hWnd, win.WM_LBUTTONUP, win.MK_LBUTTON, lParam)
}
Exemplo n.º 2
0
// 移动窗口
func win_handler_startDrag(browser *cef.Browser, args []cef.V8Value) (result interface{}) {
	fmt.Println("win_handler_startDrag")

	h := win.HWND(browser.GetWindowHandle())

	var pt win.POINT
	win.GetCursorPos(&pt)

	isDrag = true

	win.PostMessage(h, win.WM_LBUTTONDOWN, win.HTCAPTION, uintptr(win.MAKELONG(uint16(pt.X), uint16(pt.Y))))

	return
}