Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executable.
Message
 
To
26/06/2003 13:33:32
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00804326
Message ID:
00804342
Views:
32
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 instance
http://www.news2news.com/vfp/?example=147&function=10
Previous
Reply
Map
View

Click here to load this message in the networking platform