如何强制我的应用程序只打开一个 exe?qt, linux [英] How to force my application to open one exe only? qt, linux
本文介绍了如何强制我的应用程序只打开一个 exe?qt, linux的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望我的应用程序只打开一个进程,即如果一个进程已经打开并且用户想再次打开 exe - 它不会打开另一个进程.
I want my application to open only one process, i.e. if the one process is already opened and the user want to open the exe again - it won't open another process.
我如何在 Qt - linux 中做到这一点?
how can I do it in Qt - linux?
10 倍!
推荐答案
您正在寻找的是 QtSingleApplication
.
What you're looking for is QtSingleApplication
.
如果您启动应用程序的另一个实例,第一个实例甚至会收到通知(您可以传递您想要的任何数据结构).
If you start another instance of your application, the first one will even get notified about it (you can pass whatever data structure you want).
每当另一个实例启动时,我都会使用它来将现有应用程序置于最前面.
I used it to bring the existing application to the front whenever another instance is started.
这篇关于如何强制我的应用程序只打开一个 exe?qt, linux的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文