Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling another program.EXE
Message
From
11/05/2004 11:16:01
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00902816
Message ID:
00902845
Views:
9
If you use the Win API function 'ShellExecute()' to run the exe, the return value will be 32 or less if there is an error. Otherwise, the program will be executed. If there is an error, it is transparent to the user. No error message displays, so you can safely call ShellExecute, and display whatever message you like if the exe can't be found.

The errors (from API Guide 3.7) are: (I haven't looked up the numeric equivalents - they'd be in 'winerror.h' and 'shellapi.h')
0 
 The operating system is out of memory or resources. 
 
ERROR_FILE_NOT_FOUND 
 The specified file was not found. 
 
ERROR_PATH_NOT_FOUND 
 The specified path was not found. 
 
ERROR_BAD_FORMAT 
 The .EXE file is invalid (non-Win32 .EXE or error in .EXE image). 
 
SE_ERR_ACCESSDENIED 
 The operating system denied access to the specified file. 
 
SE_ERR_ASSOCINCOMPLETE 
 The filename association is incomplete or invalid. 
 
SE_ERR_DDEBUSY 
 The DDE transaction could not be completed because other DDE transactions were being processed. 
 
SE_ERR_DDEFAIL 
 The DDE transaction failed. 
 
SE_ERR_DDETIMEOUT 
 The DDE transaction could not be completed because the request timed out. 
 
SE_ERR_DLLNOTFOUND 
 The specified dynamic-link library was not found. 
 
SE_ERR_FNF 
 The specified file was not found. 
 
SE_ERR_NOASSOC 
 There is no application associated with the given filename extension. 
 
SE_ERR_OOM 
 There was not enough memory to complete the operation. 
 
SE_ERR_PNF 
 The specified path was not found. 
 
SE_ERR_SHARE 
 A sharing violation occurred. 
Alan

>I need to call another program (its not a VFP app) from within my program.
>
>Here is what I need to do:
>
>1) first of all, see if this other program is in fact installed on the persons computer (it might or might not be).
>
>2) if it is, call it and pass it a parameter.
>
>Mel Cummings
Previous
Reply
Map
View

Click here to load this message in the networking platform