Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining if Files are Open
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Determining if Files are Open
Divers
Thread ID:
00808779
Message ID:
00808779
Vues:
45
Good Morning

I have table with user numbers and user names which I extract into a cursor:

SET EXCLUSIVE OFF
SET DEFAULT TO ("U:\Data")
SET DELETED ON

Select users.userno, users.username ;
from "U:\Data\Users" ;
ORDER BY users.username ;
into cursor crsusers

this will give me a list of users and user names:

1 Neil
2 Paul
3 Simon

In a shared directory on a network drive I have the following folder structure:

U:\Profile\USER1
U:\Profile\USER2
U:\Profile\USER3

For each user in the table is a directory within the Profile directory named after the user number. Within each USER directory is a file named Insystem.dbf. The file determines if a user is in our database application i.e if you can open it they are not in the system, if you cannnot open it they are in the system.

I have a piece of code which scans for a particular insystem.dbf file and tells me this in the form of a messagebox.

What I would like to do is to scan the users in the usertable, and scan through all the insystem.dbf files within the USER number directories. Here is my code:

Lparameters lcinsystem
Local llReturn, lnFID
llReturn = .F.
If File("U:\Profile\User1\insystem.dbf")
lnFID = Fopen("U:\Profile\User1\insystem.dbf", 11)
If lnFID = -1
llReturn = .T.
MessageBox("User is in system")
Else
=Fclose(lnFID)
MessageBox("User is not in system")
EndIf
EndIf
Return llReturn

The above code is hard coded for User1 therefore I would like to scan the users table (some new users may have been added) and then somehow scan the insystem.dbf file in their respective User No directory within the profile directory to determine if the user is in the system.

I would then create a list box which will give me all the users in the system at any given time.

Can somebody put me in the right direction with this problem.

Many Thanks
Neil Lewis
IT R&D Manager
Velmore Ltd
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform