Find out instance of program

Find out instance of program

Post by Sandeep Gu » Thu, 15 Jan 2004 02:49:24


Hi,

My Point of Sales application is running on a network,
the whole application resides on a PC on a network in
c:\POS folder containing all the executable and database
named posdata, which in turn is shared, all the users
needing to run the program just map a drive to this
folder and create a shortcut on their desktop.

The program can also run on the main PC itself.

Suppose an instance of this program is running on the
main pc and another instance is also launched at station
two.

Now for certain module, I need to use the database
exclusively on the main PC and I also want to close the
database temperorily,

I WANT TO KNOW THE COMMAND OR ROUTINE WHICH CAN BE USED
TO FIND OUT IF AN INSTANCE OF THIS PROGRAM IS RUNNING AT
OTHER STATIONS.

Thanks in advance

Sandeep
 
 
 

Find out instance of program

Post by Rick Bea » Thu, 15 Jan 2004 03:21:14

Sandeep,
There are any number of ways to deal with this situation. Just getting a failure when trying to open a table exclusive is one way to know it's in use. If you need to know who it is, then you can have the application(s) lock a record in a "users" table, and then just check this file to see who is still running.

There are also API calls to determine who has what files open, although these can be dependent on the OS the file server is running.

Rick