Reputation: 863
I need to make so that my application can have only one instance running at a time. Also when it's launched with a command line parameter ( like when registered to open certain file types ) it should pass the parameter to an existing instance and quit immediately without displaying graphical interface. You all probably know what I mean. The framework used is Qt 4, and it seems like it must have some facilities for that. Any ideas?
Upvotes: 2
Views: 1016
Reputation:
There are several ways to do inter process communication. Examples can be found in Qt's examples section.
Upvotes: 1
Reputation: 863
It's also possible to implement a this sort of class oneself using QSharedMemory (see QSharedMemory::attach() ). It's capable of being used for both determining whether other instance is already running and communicating/sending messages. Except some pointer magic and memory copying it's quite straightforward.
Upvotes: 0