Launch of multiple application instances (Mac vs Win)

Paul Dupuis paul at researchware.com
Sun May 8 11:32:49 EDT 2022


Seeking help:

On MacOS when you try to launch a second instance of an application, the 
macOS just brings the open app to the front (for example, if it is 
hidden on minimized).

On Windows, when you try to launch a second instance of an application, 
Windows launches a second (or 3rd or 4th or ...) instance of the 
application.

All well and good, but here is my problem. We have some users of our 
application that, on Windows, are accidentally launching more than once 
instance of our application and then getting confused (our users are 
often not very computer literate).. This confusion can lead to them 
thinking they have lost data or other problems caused by doing some work 
in one instance and some in another and not recognizing they have 
multiple instances running.

I would like to add some start up code to application, that on Windows, 
detects if our app is already running and  (a) shuts the 2nd instance 
down OR (b) [PREFERABLY] warns the user they are launching a second 
instance and offers to (1) bring the existing instance to the foreground 
(and shut itself down) or actually continue and launch a seconds 
instance (for power users who know what they are doing)

Has anyone written code to do this?

i.e. code to detect an already running instance and code to bring that 
instance to the foreground?

If so, are you willing to share the code?

Just looking to not have to reinvent the wheel here.

Thank you in advance!




More information about the use-livecode mailing list