Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One session application access

Status
Not open for further replies.

dhenin

Programmer
Sep 27, 2000
5
FR
Hi,

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 ?

Thanks for your help.
Regards.
 
2 thoughts...

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.

good luck
 
dhenin,

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.

Piece of cake

Kelly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top