Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many users are on the system?
Message
 
To
16/03/1999 17:22:01
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00198357
Message ID:
00198530
Views:
14
Stacy,

It's actually alot more simple. The code sample below can tell if the user is logged in the system already. Using file handles automatically assures that if the users system abends, the file handle is released. It also works with all client systems since it is file system based.

* Begin

cFileName = "system\" + alltrim(gcUserName) + ".txt"
if not file(cFileName)
ThisForm.UserHandle = fcreate(cFileName, 0)
else
ThisForm.UserHandle = fopen(cFileName, 12) && Open Exclusive
if ThisForm.UserHandle <= 0
=MessageBox("User is current logged into system.")
endif
endif

* End

You can also easily modify the code to put an ADIR and count the file
locks to determine the number of users in the system, for a license count
perhaps.

HTH,Ed
Previous
Reply
Map
View

Click here to load this message in the networking platform