On Windows systems there is the concept of a GlobalAtom , I don't have the code at the moment but it is a nice way of detecting previous instances of an application.