Progress on preventing multiple instances of a program fromrunning in windows

Lynch, Jonathan BNZ2 at CDC.GOV
Fri Dec 3 10:31:55 EST 2004


I thought about something like that - but was concerned that the app
would not know if the value had been changed in the file, and then
terminated. That would not matter if the program is running as a visible
window, because the user could just see that the window is not open, and
tell the program to go ahead and run anyway.

However, I need to use this for a program that will run invisibly. If it
is running invisibly, then most users will not know how to check for
running processes to determine if the program really is running.

Using sockets allows for the program to see if it is running. My plan is
to make it so that if it is already running, the second instance will
check to see that the first instance is responsive, then when it
confirms that it is working, it will tell the first instance to make
itself visible. Then the second instance will turn itself off.

This way, the program can run invisibly, but whenever the user clicks on
the icon (which will be automatically inserted into the start menu) the
program will just appear on the screen. The user can then change
preferences and close it, and it goes back to running invisibly. (With a
separate button for shutting down the program, so the user does have the
option to turn it off, if desired)


-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Gordon
Tillman
Sent: Friday, December 03, 2004 10:13 AM
To: How to use Revolution
Subject: Re: Progress on preventing multiple instances of a program
fromrunning in windows

Howdy Folks,

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".

--gordon

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


More information about the use-livecode mailing list