I am developing an app that opens a portable browser to a specific page. The thing is that every once in a while I would like to switch the focus to the browser window, so that it will appear on top of the screen if it is minimized or if there is a window on top of it.
I've tried to do this using robotgo, by setting the active PID to my browser's PID and setting it as active, but that didn't work:
robotgo.ActivePID(26360)
handle := robotgo.GetHandle()
fmt.Println("handle: %s", handle)
mdata := robotgo.GetActive()
robotgo.SetActive(mdata)
Is there a way to do this?
Note: since I am opening this browser process myself using exec.Command
, I have its PID, so I don't have to search for it.
Note 2: I am running this program on Windows.