Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I get a VFP exe to return a return code
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00126877
Message ID:
00127019
Views:
34
>I have a need that requires a VFP exe to return a so-called "ERRORLEVEL" value.
>
>I have performed the following but it does not work:
>
>*-- My exe's initial prg looks something like this
>
>SET SYSMENU TO
>SET EXCLUSIVE OFF
>SET CENTURY ON
>
>PUBLIC m.gnRetCode && Global return code
>m.gnRetCode = 0 && Initialize return code
>
>DO FORM frmTest && Global code will be set here
>*-- The Form will execute CLEAR EVENTS upon completion
>
>READ EVENTS
>
>*-- I am assuming this is the way to return the ERROR LEVEL
>RETURN( m.gnRetCode )
>

Instead of QUIT/CANCEL/RETURN to exit from VFP, add the following code:



DECLARE ExitProcess IN Win32API INTEGER ExitCode

After closing down everything, execute the following line of code:

=ExitProcess(nReturnCode)

where nReturnCode is the error level you want to return.
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