Only one instance of a Delphi Firemonkey Windows app

  

When a user double clicks on a document, Windows creates a new instance of my Firemonkey Delphi app. I want my app to check whether another instance of the app is already running.

If another instance is already running, then I want it to switch to the original instance and make the original instance open the document – and then exit the new instance.

How is this done with the Windows API?

For those who think that this is answered by another question Only one application instance with FireMonkey it… is not. The answer to that question lists the names of the .exe files of running processes. Those .exe file names could be duplicates. The answer also does not address switching control to the original instance. (Other Stackoverflow questions did address how to get the original instance to open the document.)

Comments are closed.