go-vgo / robotgo

RobotGo, Go Native cross-platform RPA and GUI automation @vcaesar
Apache License 2.0
9.45k stars 859 forks source link

The process ID is not available #644

Open qq1792569310 opened 4 months ago

qq1792569310 commented 4 months ago
//get the current process ID
pid := robotgo.GetPid()
//get the title of the current window
title := robotgo.GetTitle()   // succeed
//Pass in the process ID to get the window title
title2:=robotgo.GetTitle(pid)   // fail
//Press A once
robotgo.KeyTap("a")   // succeed
//Pass in the process ID and press A once
robotgo.KeyTap("a", pid)   // fail

Description

In the above code, functions that do not pass in the process ID can be executed normally, for example, 'title' can get the correct title, and the key A can also be triggered normally. However, when the process ID is passed, the obtained 'title' is an empty string, and the key 'A' will not be triggered normally