[Qt-interest] How to create single instance app?
Konrad Rosenbaum
konrad at silmor.de
Fri May 7 16:24:06 CEST 2010
On Fri, May 7, 2010 16:24, M. Bashir Al-Noimi wrote:
> How I can create single instance application without Windows/Linux
> conflicts?
Single instance per what?
* per computer?
* per user?
* per screen?
* per network? (define network)
* per universe?
Short answer: put a lock file in an appropriate place, on startup try to
open it - if it is there check for plausibility (eg. store the process ID
or something similar in it and compare with reality), if it is not there
go ahead and start, if not plausible go ahead and start, if there and
plausible display an error and quit. On shutdown remove the lock file.
Test intensively.
You will probably need a handful of #ifdef's. Sorry.
Konrad
More information about the Qt-interest-old
mailing list