Progress on preventing multiple instances of a program from running in windows
got at mindspring.com
Fri Dec 3 09:13:21 CST 2004
I'm jumping in on this thread a bit late, but I wanted to let you know
what we are doing to handle this issue.
I have a preferences library that any application can use to manage,
well, preferences. It does the right thing and stores the preferences
at the proper location for mac, windows, and linux.
During the application startup code, before I start opening sockets but
after having initialized the preferences, I check for the presence of a
preference called "running" that has a value of "yes" or "no".
If the preference has a value of "yes", then the application displays a
message to the effect of "It appears that another instance of this
program may be running. That can also be caused if it had terminated
abnormally before. Do you wish to continue starting up?" The user can
click Yes or No.
Normal operation is as follows:
Application starts up. Checks the pref. Sets it to "yes" and saves
preferences (to flush the updated value out to the file). The on
shutdown handler sets the value back to "no".
More information about the use-livecode