Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning a value from a VFP exe
Message
De
17/04/2000 13:41:07
 
 
À
17/04/2000 13:19:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00359172
Message ID:
00360507
Vues:
12
>>If all you need is to terminate VFP and return a numeric status code, that's no problem, too - use the ExitProcess() API call to terminate VFP, and have it return an error code other than 0. Only integer values can be returned. There is a sample in the FAQ showing this.
>
>Could you provide a link to the FAQ or write out an example? I couldn't track down what you were referring to, besides the API call itself.
>
>A typical Tcl/Tk snippet might read like this:
>
>if {[exec MyVfpApp.exe -xf somefile.txt]} {
>---> set mystring "This is a test"
>}
>
>where [exec MyVfpApp.exe -xf somefile.txt] executes a command (the exec command, in this case) and substitutes its return code - note that the square brackes are what denote the substutution.
>
>exec's return code is the return code of the process it is executing - in this case, I am assuming that MyVfpApp.exe returns a zero for false and a non-zero for true.
>

The standard is that a WinApp or DOSApp returns 0 for successful shutdown, and any other value returned is an error condition - this is reflected as the DOS errorlevel, and is examinable with the GetExitCodeProcess() API call.

DECLARE ExitProcess IN Kernel32 SHORT uExitCode
CLOSE ALL
FLUSH
=ExitProcess(numeric exit code to return)

Don't return an exitcode of 259; that's reserved for 'Not done yet'

makes its own sauce - you need to ensure that your Tcl/tk Exec macro does a CreateProcess() and waits on the app to terminate - you may have to use the START verb to force a wait - don't use Tcl myself.

>I also added three parameters (two flags and a positional) to demonstrate typical Unix-style parameter passing.
>
>What I want to know is whether executing ExitProcess() will properly return an integer in this manner, and how I would integrate this in my framework's shutdown routine.

Use ExitProcess() as shown above as an alternative to QUIT. Like I said, makes its own sauce. This Win32 stuff is easy...
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform