Hi John,
A possible way is using a
synchronization object -- mutex, semaphore, or event -- with a predefined name. That can be a name of an executable file, or a name of your application -- any legal name.
On start your application tries to open a synchronization object with this name. If succeded -- that means the object was already created with another instance, which is currently running. So this application instance must be closed.
If there is no such object, then your application creates it, preventing all following instances from starting. Created synchronization object will be closed automatically on the application's exit.
Here is a sample code, which uses API functions
CreateSemaphore and
OpenSemaphore (member area):
Using a Semaphore object to secure your VFP application running only one instancehttp://www.news2news.com/vfp/?example=147&function=10