Single instance application...
Posted on 2004-11-26
I have developed an application that takes custumized protocol links from a web page. I had to write a registry key to invoke the program but I have succeded.
Here is the scenario:
just like http, ftp, and ed2k links, I have written a registry key so that if a URL in a web page contains a specific protocol lets say "myapp" as in
<a href="myjavaapp://|parameter_1|......|parameter_n|">Click here</a>
"myjavaapp" is invoked and from the link above receives the parameters.
If "myjavaapp" is not running there is no problem. The application is started.
If "myjavaapp" is already running a new instance of the program is run. So I have two copies of the same program running on my desktop.
What should I do to make this program run in one instance? I have been told to create a file on startup of the application and delete when exited, but incase my application crashes the file would not be deleted, thus if I check the existanse of that file, since it would exist from a previous crash, the application would not run.
So what should I do other than "creating and deleting a file upon start and exit" option?