Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Program looking at wrong table
Message
From
17/05/2013 04:46:09
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
16/05/2013 13:02:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01573918
Message ID:
01574164
Views:
85
>We had run into similar sort of problems -- typically when printing. So what we did was to save the current directory, print, then reset the current directory:
>
>lcOrgDir = SYS(5)+SYS(2003)
>
>REPORT ....
>
>SET DEFAULT TO (m.lcOrgDir)
>
>
>You may also find that some system dialogs that do equivalent of GETFILE(), PUTFILE(), GETDIR(), FINDFILE() will sometimes change the current directory -- in those cases you can do a similar bit of saving the current directory before the operation, then restoring it. Another approach is to simply have a global setting for "current directory" for your application -- then restore the current directory as required (often in cases where certain system dialogs that change current directory gets changed, or in cases where an external program might change the current directory).

Since hunting down these things is near impossible, i.e. there are so many things which may change the default directory at unpredictable times, I've added a check to the application's maintenance timer. On launch, it saves the current location in a property, and then the timer code just checks if it's still on that location, and changes back if not. This also means that nowhere in the code it is assumed that it should run anywhere else. Any file operations are always done with full paths.

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