Launch of multiple application instances (Mac vs Win)

Klaus major-k klaus at major-k.de
Sun May 8 11:37:08 EDT 2022


Hi Paul,

> Am 08.05.2022 um 17:32 schrieb Paul Dupuis via use-livecode <use-livecode at lists.runrev.com>:
> 
> 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.

just add this "dummy" handler to your stack:
----------------------------
on relaunch
  ## Nada :-)
end relaunch
-----------------------------
That will prevent the launching of multiple instances on Windows!

> Thank you in advance!

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
klaus at major-k.de




More information about the use-livecode mailing list