Avoid multiple instances of clipper application
Use low-level file functions. You should use some dummy temporary file (e.g.
'myapp.lck').
On the program startup you should open that file for exclusive access
(e.g. by using the FOpen('myapp.tmp', FO_READ+FO_EXCLUSIVE)),
and leave it locked while the program runs, and on the program quit
close the file (if the application terminates irregularly, the lock will be
removed by the OS). If FOpen() fails, that will probably mean that is it
locked by the running app instance, but you should check FError() for
other possible causes of error.
If this is to be used in network environment and you want multi-user access
but you want to limit the number of instances for particular user/computer,
then don't create temporary lock file in the application directory, but in
some local folder (e.g. Windows folder, you can get it's name from the
environment var), or use network username to name the lock file.
Home