limit program access to only one at a time on network lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- BorisSobad · 2012-02-17 19:20 Can I limit a program on a network so that it can't be opened by more than one person at a time? Otherwise data files saved in program could be in error. I can do this in VB but I'm not sure how to do it in Pascal. ---------------------------------------------------------------------- TurboRascal · 2012-02-17 21:30 You mean, limit data files so they can be open from one place only? Why would you enable them at all to get opened from different machines if so? Wouldn't it be wiser to implement some sort of locking mechanism? You could even try using a smaller RDBMS, it wouldn't be harder at all... ---------------------------------------------------------------------- joseme · 2012-02-18 00:45 You can read the good note from Zarko Gajik at http://delphi.about.com/od/windowsshellapi/l/aa100703a.htm . If you want to use a component for this, you can install lazsolutions package and look for LSRunOnce into Demos. ---------------------------------------------------------------------- BorisSobad · 2012-02-18 01:07 What I've have is an e-logbook. The log book needs to be available from different sites but if one person is updating the book at site A, I wouldn't want someone else to be able to update at site B till the first is done. ---------------------------------------------------------------------- ludob · 2012-02-18 07:27 QuoteI can do this in VB but I'm not sure how to do it in Pascal.How would you do it in VB? That would help us to figure out what type of solution you are looking for. Locking data, locking program,  ... ? ---------------------------------------------------------------------- fabienwang · 2012-02-18 09:20 Hello, You can simply use this way: 1) the person opens the app 2) the app checks if there is a file called alreadyopened.txt with 1 into it 3) if the app is already open, app closes or show an error message 4) if not, then the program can be used, but it will update alreadyopened.txt with 1 into it. 5) the person finished to update the book (click on save? or close the app) and the alreadyopened.txt contains now a 0. Done PS: of course the file alreadyopened.txt has to be in  shared folder like your application (as i understood). ---------------------------------------------------------------------- BorisSobad · 2012-02-18 16:12 I did it in VB similar to the way FabienWang suggested using onclose to change the file status. I don't change the file; I delete or create one instead. I didn't know if there was a standard way in free pascal and I'm not sure how to use the onclose function in free pascal. Okay figured out onclose event. I  couldn't get it to delete a marker file each time I closed but was able to get it to create one with onclose event so I'm good thank you. ---------------------------------------------------------------------- fabienwang · 2012-02-18 23:15 Quote from: BorisSobad on February 18, 2012, 05:12:28 pmI did it in VB similar to the way FabienWang suggested using onclose to change the file status. I don't change the file; I delete or create one instead. I didn't know if there was a standard way in free pascal and I'm not sure how to use the onclose function in free pascal. Okay figured out onclose event. I  couldn't get it to delete a marker file each time I closed but was able to get it to create one with onclose event so I'm good thank you. the LSRunOnce as suggested by joseme, will restrict to 1 application / computer (or per user on the system). While the method i told you will also work if the file is in a shared directory ---------------------------------------------------------------------- TurboRascal · 2012-02-19 01:03 So, essentially you seek the Microsoft OneNote behavior?