Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameters between VFP executables?
Message
De
04/11/1998 11:06:36
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00154105
Message ID:
00154353
Vues:
19
Hmmm...without COM this is kind of a difficult thing to do. You might want to try this:

LOCAL llTerminated
oRunExe=CREATEOBJECT("VisualFoxPro.Application")
oRunExe.docmd("SET DEFAULT TO [location of exe]")
oRunExe.docmd("glTerminated=.F.")
oRunExe.docmd("DO whatever.exe")
llTerminated=oRunExe.eval("glTerminated")
IF llTerminated
[.exe terminated successfully]
ELSE
[.exe did not terminate succesfully]
ENDIF
RETURN

In the .exe, have code like this upon succesful completion:

IF [exe terminated properly]
glTerminated=.T.
ENDIF

glTerminated does not need to be declared since it will be public by virtue of having been scoped to the instance of VFP created by the calling program.

I've never actually implemented this solution before so you might want to test it out. Some possible gotchas exist, like if the .exe crashes and clobbers the instance of VFP then oRunExe won't be an object anymore. You can test for that with
IF TYPE("oRunExe")#"O"
[VFP crashed]
ENDIF

or, in VFP6.0,

IF VARTYPE(oRunExe)#"O"
[VFP crashed]
ENDIF

I think you really might want to consider switching the implementation here to COM servers, since what you are relly trying to accomplish is a component model.

>Yeah, I guess I was vague... I have an executable that will run other executables as they are created by other programmers, like ...
>
>lcProg = "whatever.exe"
>.
>.
>.
>DO (lcProg)
>
>... what I need is a return value from "whatever.exe" that let's my program know whether that .EXE terminated normally (.T.) or abnormally/errored (.F.), so that my program can continue in the appropriate manner (and update a process table). I can't include those other programmer's .EXEs in my project because they are created continually from now on.
Eric Shaneson
Cutting Edge Consulting
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform