[PyQt] Detect Application Running

Tim Golden mail at timgolden.me.uk
Sun Jan 10 10:15:52 GMT 2010


On 10/01/2010 03:49, AON LAZIO wrote:
> Hi,
>       How can we find out that there is already a PyQt application running on
> Windows so when I try to open that same application, it won't open another
> one?
>       It's like I already have Firefox running and when I open firefox again,
> it won't open firefox again.
>       Thanks

Qt aside, the canonical way to do this on Windows is by
using a mutex. Have a look at this recipe:

   http://code.activestate.com/recipes/474070/

Now Qt has its own mutex object:

   http://doc.trolltech.com/4.6/qmutex.html

but it doesn't look as though it works cross-process, and I haven't
looked at the underlying code to see if it wraps the Windows Mutex
object or not. Probably some variation on the recipe above is your
best bet.

TJG


More information about the PyQt mailing list