dsq30861 2018-11-25 14:35
浏览 129

如何在Go中获取onMouseDown事件

Is there a simple way to get the mouse events, like when the left button is clicked, and when it is released in Go ?

And also is it possible to get that information even is the mouse is not hover the window's program ?

I'd like to draw a square over the screen, between the beginning and the release of the click, to capture that part of the screen.

Thank you

  • 写回答

1条回答 默认 最新

  • douhong6187 2018-11-25 14:41
    关注

    Try with robotgo - Golang Desktop Automation

    import (
        "fmt"
        "github.com/go-vgo/robotgo"
    )
    
    func main() {
    
     // mouse events: mleft, mright, wheelDown, wheelUp, wheelLeft, wheelRight.
      mleft := robotgo.AddEvent("mleft")
      if mleft == 0 {
        fmt.Println("you press... ", "mouse left button")
      }
    } 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了