Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP's share setting for opening source files?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00699834
Message ID:
00700074
Views:
14
>Hello. I have written a simple PRG to search my VCX files for certain pieces of text. However, if I run it while I have the class open in VFP(viewing code), I am unable to open the file. My program attempts an FOPEN(,0) on the file to determine if it can get readonly access to it, and this fails. The only thing I can guess, is that VFP opens source files in a non-sharable way(dwShareMode==0). Is there any way to have VFP open source files("vcx", "scx", etc.) in a shared way(dwShareMode==FILE_SHARE_READ)? The files on the file system are already read-only(VSS does this), so there are no data integrety issues. Ideas? Thanks.

Hi Derek,

There is something else going on here;
Firstly, the VCX is opened shared. Why ? because we just can USE it. Right ?
Secondly, the FOPEN(,) still can't open it. Why ? well, because it's already opened. So, stuff it ? Not really.

From some tests I've done, it is the most likely that VFP has an internal normal USE for it. This, opposed to have it low-level opened (thus which IMO is not the case).
A super-sidenote would be that the below lines are influenced by the combinaton of the Win-OS and VFP. This, opposed to FPDos (huh ? VCX ... no, it's not about that) where all works slightly different. BTW, I had to look into this carefully in the past because it has to do with locking issues at the file level in general.
So here's the story :

The Win-OS (and I recall far away that W95 is different from NT) can't "low-level - read only" open a file that's already open in the same WIN-task. However, it just can in the other. So, the other task can be looked at as just another network connection (IOW, results on the other PC are exactly the same), and I guess that the one Task allows for one (file)handle to the file only. That is, if it were for low-level opening.
Note again, that this is not the OS only, because VFP deals with it differently from FPDos (hence there this would work, for the sake of "just files").

Knowing this, you have two solutions :

1.
Create another task (Form as Toplevel etc.), and do the job in there. It just works, as long as you don't open the classlib in there ;)
The problem, obviously, might be the communication between the two tasks (and I don't really know what you want to do exactly).
I (just) tried it with another Datasesssion, but that doesn't help.

2.
USE the VCX and go through the table just by scanning all the fields (or whatever you want to do in there). I'd say this is even more convenient, because you will always "know where uou are". It's no big deal at all.

I hope you can use this to get around the problem.

Peter
Previous
Reply
Map
View

Click here to load this message in the networking platform