Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many users are on the system?
Message
 
À
16/03/1999 17:22:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00198357
Message ID:
00198530
Vues:
15
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform