Thread: PrevInstance

  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Rep Power


    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?
  2. #2
  3. No Profile Picture
    Overly white
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Fresno, CA
    Rep Power
    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.

IMN logo majestic logo threadwatch logo seochat tools logo