Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WinExec() return codes
Message
From
08/03/1999 11:22:21
 
 
To
08/03/1999 11:12:38
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00195166
Message ID:
00195173
Views:
19
>When I use WinExec() to run the following DOS command
>
>copy > lpt1
>
>the function returns the value 2.
>

Error 2 is 'File not found'

>I am needing to know what this code means and/or if there is somewhere I could get a listing of all possible error codes. Also can this command be successfully used with WinExec() or should I try something else such as ShellExec().

The errors are documented in the MSDN; the best single source is the .H files for VC++; in this case, WINERROR.H provides the details.

WinExec() is present only for backwards compatibility with Win16; it's been largely superceded by CreateProcess() and ShellExecuteEx(). I wrote a class called API_APPRUN, available for download here on UT, that implements program execution using CreateProcess(); you might want to examine it.

FWIW, the commandline you've given is completely invalid in any case; if you want to copy a file's exact content to LPT1, you'd use something like:

COPY /B filename LPT1.DOS

This functionality is available without resorting to API calls or external commands with the VFP TYPE command, or with COPY FILE, or any of a number of other options.
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
Reply
Map
View

Click here to load this message in the networking platform