Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Executable.
Message
 
À
26/06/2003 13:33:32
John Vlahos
V I Software Solutions Design
Mississauga, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00804326
Message ID:
00804342
Vues:
33
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform