gpt4 book ai didi

windows - Windows 和 QWidget::activateWindow() 中的事件窗口

转载 作者:可可西里 更新时间:2023-11-01 13:59:49 27 4
gpt4 key购买 nike

QWidget::activateWindow() 的 Qt 文档指出:

On Windows, if you are calling this when the application is not currently the active one then it will not make it the active window. It will change the color of the taskbar entry to indicate that the window has changed in some way. This is because Microsoft does not allow an application to interrupt what the user is currently doing in another application.

但是,Skype 似乎违背了这条规则。如果 Skype 正在运行但不是事件应用程序,我可以从开始菜单启动它,它将现有实例带到前台,激活它并获取输入焦点。

如何做到这一点?

最佳答案

(注意:这特定于 QtSingleApplication 的工作方式)

对于我的问题,解决方案非常简单。只需在应用程序开始时调用 AllowSetForegroundWindow(ASF_ANY);,原始进程就可以通过使用 SetForegroundWindow() 将自己带到前台。没有奇怪的技巧,只需添加一行代码,也不需要修改 QtSingleApplication。

关于windows - Windows 和 QWidget::activateWindow() 中的事件窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3316350/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com