Go how to get mouse/Cursor position on windows

huangapple go评论88阅读模式
英文:

Go how to get mouse/Cursor position on windows

问题

我正在尝试在Go语言中获取Windows光标或鼠标的x和y位置。
我已经找到了这个包https://github.com/go-vgo/robotgo,它可以监听鼠标事件,但我找不到用于此的代码。

func getCursorPosition() (x, y int) {
    return 0, 0
}

我想用真实的光标位置替换"0,0"。

谢谢你的帮助!

英文:

im trying to get the x and y position of the windows-cursor or windows mouse in Go.
I already found this package https://github.com/go-vgo/robotgo which can listen for mouse events, but i cant find the code which is used for that.

func getCursorPosition() (x, y int) {
    return 0, 0
}

I want to replace "0,0" with the real cursor position.

Thanks for your help!

答案1

得分: 2

你是否阅读了文档

如果你阅读了,你可能会注意到函数GetMousePos() (x,y int)

英文:

Have you read the documentation?

If you had, you might have noticed the function GetMousePos() (x,y int).

huangapple
  • 本文由 发表于 2022年10月22日 03:39:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/74158486.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定