Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Like GetUserName
Message
From
14/12/1998 22:21:00
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00135034
Message ID:
00167520
Views:
18
>I have all users with their own resource file and logged into a user file. Sure, the "loggedin" field may often be left .T. because they turn their machine off without logging out etc, so my "Who's here?" function tries to open exclusively each (apparently) logged on users resource file. If it fails, they're "really" logged on, if not, I reset the flag to .F. and report them as not logged on.
>HTH
>Dave Bower
>-------------------------------------------------------------------------------
>My solution is similar but without individual FoxUser files. When each user runs the app, they try to lock their record in the user table. If they can't, either they're logged on somewhere else (not allowed), or a supervisor has the user table open exclusively (to do a single-user function like reindex).
>
>When a supervisor wants to do a single-user function, the app first tries to use the user table exclusively. If that fails, the "who's here" function loops through the user records and tries to lock them individually. Ones it can lock, the user's not there. Ones it can't lock get inserted into a table which is displayed in a grid for the supervisor. The grid shows usernames and extensions so the super can tell these people to get out.
>
>The supervisor can hit a refresh button which repopulates the grid table until everyone's out and they can get exclusive use of the user table. Then no one can get in (because they can't open the user table to lock their record) until the supervisor is done with their single-user function.
>
>Theoretically, if the users turn off their machine without properly exitting, the network will release their lock on the record in a short time. This is largely untested so far ... comments welcome ...
>
>Rich

Hi Rich,
That's a pretty darn good alternative. Will be much faster too than trying to get exclusive access to a resource file (which only fails after about 10-20 secs)
Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform