 |
| Using the Semaphore object to allow only one instance of VFP application running |
User rating: 0/10 (0 votes) | |
|
|
 |
 |
| Before you begin: |
 |
The best way to test this sample is to create a project with the code below and compile it in an executable file. Though whichever way you choose: an executable, an application, or another VFP instance -- this code works fine.
See also:
Using shared memory to exchange data between two FoxPro applications
How to prevent users from accessing the Windows Desktop and from switching to other applications |
 |
 |
| |
| |
Members area. Log in to view this example. |
|
| |
|
|
|
|
|
 |
User rating: 0/10 (0 votes) | |
| 1560 bytes Created: 2001-09-16 12:00:00 Modified: 2011-12-10 09:20:22 Visits in 7 days: 85 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
A combination of two functions -- Create... and Open... -- is used, and it is not the only Semaphore object good for this task.
Same can be done with Mutex object (MutuallyExclusive), or Event object. First you try to open the named object. If it already exists, that means another VFP application instance is running. Otherwise you create the object within this instance. |
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|