Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many users runing my EXE
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00973821
Message ID:
00974030
Vues:
21
Hi Marvin. I think you mean ISRLOCKED() function and not RLOCKED()? If so then this will not work because ISRLOCKED() only returns .T. if the current application has a lock on the record. It returns .F. even if another app has a lock on the record.

However, I do use exactly this same idea but instead of using ISRLOCKED() I try to lock the record myself using plain RLOCK() and SET REPROCESS TO 0 SECONDS for a single attempt. I count how many records could be locked to determine how many concurrent users are currently in the system. If the RLOCK is succesful then I immediately UNLOCK it to free the record. Then if the system is set up to allow at least one more concurrent user than what is currently in then I LOCK() this users record in the LICENCE file. Perhaps RLOCKED() is your custom function for this same thing?




>Hi!
>
>1. Create A Table : \\SERVER\LICENCES.DBF Fields (USER C(50),TIME T)
>2. in your start app use COUNT FOR USER#SYS(0) AND RLOCKED() TO lnOnlineUsers 3. CREATE A RECORD or use the same one if not already found with USER=SYS(0), if not already locked in the Table (because a user should be able to use multiple Instances)
>4. Lock the Record
>5. If an app crashes the lock will automatically be released. Thats all.
>
>
>Note:
>- Speed up finding locked Records with "SET REPROCESS TO 0 SECONDS"
>- Sys(0) is not useable for Terminal Client Sessions, because it will contain the same data in every session
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform