dprc88435 2017-11-08 21:15
浏览 140

Golang如何在顶部设置窗口

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法