Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DO FILE can run FILE.mpr instead of FILE.prg
Message
From
27/07/1999 13:33:50
 
 
To
27/07/1999 12:25:55
Karl Zercoe
Titanium Software, Inc.
Houston, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00246686
Message ID:
00246745
Views:
14
>If I call programs with the same name and different file extensions then FoxPro seems to get confused about which program to run.
>
>I have three files.
>Main.prg
>Program1.prg - Contains 1 line of code eg WAIT WIND "PRG"
>Program1.mpr - Contains 1 line of code eg WAIT WIND "MPR"
>
>Main.prg consists of the following three lines and is run from the command window with DO MAIN:
>
>do Program1 && This runs Program1.PRG as expected
>do Program1.mpr && This runs Program1.MPR as expected
>do Program1 && This runs Program1.MPR again instead of Program1.PRG

You're running into a problem because VFP caches the names of things it knows about - if you use an indistinct name for a function or procedure contained in an external file, and VFP has resolved it before, it will use the last occurance. You can switch back to having it resolve the name using its normal priorities by issuing a CLEAR PROGRAM, which clears all programs from VFP's cache and name table, with a corresponding performance hit, but then by referinng to things that have to be resolved externally by a file name, you're already taking the hit...

>
>If I compile it and run the APP or EXE then I get:
>
>do Program1 && This runs Program1.PRG as expected
>do Program1.mpr && This runs Program1.MPR as expected
>do Program1 && This runs Program1.PRG as expected
>
>I recently updated to Service Pack 3 and found this behavior. This behavior only exists after Service Pack 3 was installed and only if you run it as individual files. If you compile it into an application or executable it works as expected. I had another colleague test this who had not updated to Service Pack 3 and she said it behaved as she expected before installing the update and then differently after. This leaves me to believe that it is not specific to my computer/configuration.
>
>I know of some work-arounds like making sure that all file names are unique. I know you can specify a PRG extension for DO FileName.PRG but that will not help me if FileName is a function since X = FileName.prg() is not valid syntax.
>
>Confirmation of this behavior would be appreciated along with any suggestions. I can change my source code in my legacy applications if I know that there is no other option. I am currently having to compile my application into an APP or EXE everytime just to test it.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform