Code Monkey home page Code Monkey logo

Comments (11)

vcaesar avatar vcaesar commented on May 14, 2024

You should give more information,I do not know in which system to reproduce it.

from robotgo.

appleatiger avatar appleatiger commented on May 14, 2024

package main

import (
"fmt"
"time"
"github.com/go-vgo/robotgo"
)

func main() {
sum := 0
for {
sum++
if sum > 99999999 {
break
} else {
time.Sleep(5 * time.Second)
mdata := robotgo.GetActive()
fmt.Println("mdata--", mdata)
hwnd := robotgo.GetHandle() //获取当前窗口hwnd
fmt.Println("hwnd--", hwnd)
}
}
}
i can get mdata,but cannot get hwnd。win7 x64

from robotgo.

vcaesar avatar vcaesar commented on May 14, 2024

@appleatiger
"hwnd := robotgo.GetHandle()" and "
for i := 0; i < 3; i++ {
fhwnd := robotgo.GetHandle()
Println("fhwnd---", fhwnd)
}"
is normal, but in this can't get hwnd,Maybe the runtime error or cgo bug, I will troubleshoot it.

from robotgo.

vcaesar avatar vcaesar commented on May 14, 2024

you can use it in windows:
hwnd := mdata.HWnd
fmt.Println("hwnd--", hwnd)

from robotgo.

appleatiger avatar appleatiger commented on May 14, 2024

if use hwnd := mdata.HWnd,i can see a string like this :"&{6619242}",it cannot be used for "SetHandle(hwnd)"

from robotgo.

vcaesar avatar vcaesar commented on May 14, 2024

hwnd := int(mdata.HWnd), Type conversion.

from robotgo.

appleatiger avatar appleatiger commented on May 14, 2024

cannot convert mdata.HWnd (type robotgo._Ctype_HWND) to type int

from robotgo.

vcaesar avatar vcaesar commented on May 14, 2024

I see,I use Windows test it,I use mac test it before this.

from robotgo.

vcaesar avatar vcaesar commented on May 14, 2024

Because of golang not have Macro definition, Let me think about it.

from robotgo.

vcaesar avatar vcaesar commented on May 14, 2024

Please try GetBHandle.

from robotgo.

appleatiger avatar appleatiger commented on May 14, 2024

good job!

from robotgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.