Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I know if a file is already used as a resource f
Message
From
13/02/1999 12:31:55
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00186749
Message ID:
00187400
Views:
18
>>>On a network. Everyone has their own resource file that has their userid in the file name. Unfortunately I did not forsee that some users might attempt log onto the system more than once. For various security reasons, they are not allowed to do this. But my setting of the resource file to their useridresource file gets them multiple messageboxes. the useridresource file is already being used.
>>>
>>>How can I know that a file is already being used?
>
>>Generally, you may trap for an error opening any DBF file:
>>ON ERROR lErrorflag=.t.
>>USE mytable EXCL
>>ON ERROR
>>IF lErrorflag=.t.
>>*** do something here
>>ENDIF
>
>Good idea. I could use an on error for my "set resource" statement. Then I could assume that the error was that the file was already in use. I already have an error handler. It is not an ideal solution. Is not there someway I can just ask if a file is already open?

You can try to FOpen("mytable.dbf"), and it will return a zero (or -1?) if it can't open.
 lnFhandle=fopen("MyTable.dbf")
if lnFhandle>0
   * it's ok
else
   =messagebox("Get out first, then get in")
   quit
endif
=fclose(lnFhandle)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform