PDA

View Full Version : only one instance of an application in windows



jorgeact
24th October 2008, 18:57
como controlar que solo se pueda abrir una vez una aplicacion en windows.
la aplicacion .exe utiliza Qt4

how to check that can be opened only once an application in windows.
the application. exe uses Qt4

thank

Boron
24th October 2008, 19:54
Open a TCP port. If another instance of the application starts and also tries to open that port, the port is already used. Then you can quit the new instance.

Or:
When your application starts, check if a dedicated file exists (e.g. yourApp.lock). If not, create that file and continue loading (don't forget to delete that file when exiting). If it exists it must be created by another instance of your application. Then you can exit.

jpn
26th October 2008, 10:41
See QtCentre Wiki: SingleApplication