Is it possible from a clipper application to limit the access to one session by user ?
Is there a function to control this ? Is it possible to use a Windows API ?
1. possibly use your dbf's in exclusive mode..
2. have your program start by checking for existance of a particluar file (ie user.txt) and if it exists, meaning someone else is started the app, inform the user, then shut down. If file doesnt exist, assume only user, have the app make the file and proceed with normal operation.
It sounds like you are looking for a way to limit a specific user to run the program only one session at a time, but also allow other users to run it - one session at a time - for each user.
If that's the case, the best way is to do this was suggested by gs001 with a little change. You will need to create a .dbf file for each user that needs to run the program. The .dbf file can be only one field in length, and have zero records. So, if you have two users, John and Jane that uses the program, create john.dbf and jane.dbf files. When the user runs the program, have it try to open their named .dbf file exclusively. You can determin who is using the program by a function call to: netname().
This should work all the time without fail. The other option gs001 suggested - user.txt - would work too, unless the program crashed and didn't get a chance to clear the user.txt file when it terminated. This will cause you to have to delete that file everytime the program terminates unsuccessfully. Excedrin headache number 47.
Using the .dbf files, when the program crashes and the computer is re-booted, the .dbf file is able to be opened again by the same user, but only one session at a time.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.