Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using variables in DOS
Message
De
03/09/2007 10:11:22
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Versions des environnements
Visual FoxPro:
FoxPro Dos
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01251953
Message ID:
01251965
Vues:
33
>Hi Martini
>
>I need to set the variable from within FPD26, but I dont want to interfere with the Foxpro variables

Tough one. If you launch FP, it lives in its own instance of command interpreter (used to be command.com, cmd.exe nowadays). If you run a batch file to set the variable, it gets its own instance of the interpreter, where the variable is local, and gets destroyed when the interpreter exits.

You may return a number from your main procedure, quit FP, and then check ERRORLEVEL in the batch file you use to run FP, then set the variable according to is value, then restart your app. Tricky, I know, but I don't know any other way.

Except, there's an even more convoluted trick: run your app from a .bat file, where your FP call is the last active line. From within your app, add a line to set the variable to this batch file, and another to restart your app (a GOTO the line where it was started). Then your restarted app would still live in the same instance of the interpreter, and would see the variable.

The point with this trick (which worked at some point in 1991, not sure if it would still work) is that the command interpreter reads the .bat files one line at a time, then closes it. So you can add to it while it works - only when you quit FP will the interpreter go looking for the next line. This is about the only way I know that a FP application can influence its caller.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform