The following approach has worked quite well (I'm using it in sostronk.com's
desktop app):
// H
class UniqueApp : public QObject
{
Q_OBJECT
public:
explicit UniqueApp(QObject *parent = 0);
static bool anotherInstanceRunning();
void monitor();
signals:
void anotherInstance();
] Preventing Multiple Instances of EXE
Maybe this will help:
https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication
On 04/22/2016 12:07 PM, Jason Kretzer wrote:
Everyone,
Anyone know how to prevent multiple instances of an exe to be started? So, I
start bob.exe. I then I try
Maybe this will help:
https://github.com/qtproject/qt-solutions/tree/master/qtsingleapplication
On 04/22/2016 12:07 PM, Jason Kretzer wrote:
Everyone,
Anyone know how to prevent multiple instances of an exe to be started?
So, I start bob.exe. I then I try to double click and start bob.exe
Take care which mecanism you use here, this get really annoying with some
crashing application (not only they crash, but to refuse to launch again).
To avoid this, simply use a pid file and check if the pid process still
run, give option to your user to kill the previous instance of the program
Hello,
This is ordinarily done with the help of a global locking primitive (for
example a global mutex). On the first run the mutex would be locked, and if
locking fails on the second one, you just exit the application.
IMPORTANT: As any global resource, special care should be taken to release
it
Everyone,
Anyone know how to prevent multiple instances of an exe to be started? So, I
start bob.exe. I then I try to double click and start bob.exe again while the
first is still running and a second instance does not start (or at least shuts
itself down or does anything other than start