Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scanning for a file that is open
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Scanning for a file that is open
Miscellaneous
Thread ID:
00878210
Message ID:
00878210
Views:
67
I am trying to find out whether a list of users in my application are in the application. I have a user table named users. This list all users. Each user has a unique user number stored in the table. In a directory named Profiles I have a directory for each user with the name of the user being the name of the directory. An example of the user table:
Name              Number

Paul              100
Simon             120
In the profile directory you would see:
U:\Profiles\User100
U:\Profiles\User120
When a user logs into the system there is a file named insystem.dbf in the profile directory which is opened. Therefore what I would like to do is to scan the user table to grab the users. Then goto the equivalent PROFILE directory numbers and determine whether each of there insystem.dbf files are open. If they are open I would like to list the username in a list box. Here is my code to date. I cannot get this working for some reason I get a function, argument is invalid.
SET EXCLUSIVE OFF
SET DELETED ON

Select users.userno, users.username ;
  from "U:\Questpdm\Data\Users" ;
  ORDER BY users.username ;
  into array arrUsers

if ( _Tally > 0 )
for ix = 1 to alen(arrUsers,1)
  If File("U:\QuestPDM\Profile\User"+ltrim(str(arrUsers[ix,2]))+"\insystem.dbf")
    lnFID = Fopen("U:\QuestPDM\Profile\User1\insystem.dbf", 12)
    If lnFID = -1
      MessageBox("User "+trim(arrUsers[ix,1])+" is in system")
    Else
      Fclose(lnFID)
      MessageBox("User "+trim(arrUsers[ix,1])+" is not in system")
    ENDIF
  ENDIF
 ENDFOR
endif
Can anybody help me please?
Neil Lewis
IT R&D Manager
Velmore Ltd
Next
Reply
Map
View

Click here to load this message in the networking platform