Ken,
I am still a little fuzzy or am missing something. But here are some ideas that might help.
When VFP starts, you can ask it for the folder in which it is located (A SYS function?). When you open a table, you can get the table path using a different function. If the exe and tables are in the same place, you can then have a table with a single row. If some process is going on, it will open the table either exclusively or open it and put a lock on it.
The table could include the name of the respective folders that were used. If the data is somehow opened by a combination that is allowed, then you would add a second record (if/as appropriate) and put the lock on that record (so no exclusive option here.)
So now you know the folders where the exe and data are stored.
After that, you can then have your code continue or alert the user and exit.
Fletcher
Fletcher Johnson FletcherSJohnson@Yahoo.com LinkedIn.com/in/FletcherJohnson twitter.com/fletcherJ strava.com/athletes/fletcherjohnson 408-946-0960 - work 408-781-2345 - cell
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Ken McGinnis Sent: Tuesday, July 23, 2019 10:37 AM To: ProFox@leafe.com >> ProFox Email List Subject: vfp9 exe
We have a vfp9 SP2 program that has been running nearly bug free for over 10 years. Only now we have a need to find out if anyone else is using the exe in a specific folder. We allow many users to have their own unique folder with their patient data files.
So we log into folder 1 and another user is in folder 2. No problem.
If we log into folder 1 and another user is in that same folder, again no problem. Our software is multi-user down to the individual record level. The problem is when the 2nd user comes in and needs to lock many or all files to reindex or other procedures. How can the 2nd user know that another user is there? Again it is not a problem until that 1st user starts to do something, almost anything that requires accessing files. All files are locked by the 2nd user so the 1st user starts getting errors.
We could try to lock the exe and that would fail so we would know someone else is using the software. However, if that other user is working with data in a different folder, we don't care so we do not want to lock the exe.
Hope that is clear
[excessive quoting removed by server]