Example #1
0
// Set the current position of the mouse in window coordinates
func (wi *windowInternal) setMousePosition(x, y int) ThreadError {
	if !wi.window.IsValid() {
		// TODO ERROR
		return nil
	}

	point := C.POINT{x: C.LONG(x), y: C.LONG(y)}
	if C.__ScreenToClient(wi.window.Handle, &point) == 0 {
		return NewThreadError(fmt.Errorf("ScreenToClient (%d)", C.GetLastError()), false)
	}

	if C.SetCursorPos(C.int(x), C.int(y)) == 0 {
		return NewThreadError(fmt.Errorf("SetCursorPos (%d)", C.GetLastError()), false)
	}

	return nil
}
Example #2
0
// Set the current position of the mouse in desktop coordinates
func setMousePosition(x, y int) {
	if C.SetCursorPos(C.int(x), C.int(y)) == 0 {
		// C.GetLastError()
	}
}