April 24th, 2003, 01:40 PM
I know you can use PreInstance to stop a second occurance of a app on a Windows enviroment on a single client. But if a instance is running on a client how can I stop any other client from running the same app?
April 24th, 2003, 02:33 PM
You could just write a "lock file" to a common directory on the server. Then when your app starts have it look and see if the file exists. If it's exists then close the program otherwise starter up. When a user closes the app have it delete the lock file. The only problem with this is that if the app crahses then your lock file will not get deleted. To protect against this your going to have to come up with some solution to check that the user who created the lock file is still using the app. Maybe you could write a program to run on the server that will check the lockfile and see if anything has been written to it. If it has changed then keep it otherwise delete. Then have the client app every 10 mins or so write something like the time to the file.