Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CreateProcess vs ShellExecute
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
CreateProcess vs ShellExecute
Miscellaneous
Thread ID:
00098773
Message ID:
00098773
Views:
136
I have a two-part question. First, I have been able to use WaitForSingleObject in conjunction with CreateProcess to wait infinitely until my process finishes. Has anyone had any luck doing the same with ShellExecute? I know I could use FindWindow in loop, but I would like to use WaitForSingleObject.

Next, I am trying to use CreateProcess to execute the Lotus Organizer Compact program. Whenever I do this I get the following error: ASWANT_ERROR: (Error 253(0xfd): Unknown ID - ASD_UNCHANGED). When I use ShellExecute instead, it works. The code is below.

The funny thing is if I run the program from my NT 4.0 WorkStation, I do not get the error (it works). When I run from our NT 4.0 Server, it fails. Does someone have an idea?

DECLARE Integer CreateProcess IN Win32API ;
String lpApplicationName, ;
String lpCommandLine, ;
String @lpProcessAttributes, ;
String @lpThreadAttributes, ;
Integer bInheritHandles, ;
Integer dwCreationFlags, ;
String lpEnvironment, ;
String lpCurrentDirectory, ;
String @lpStartupInfo, ;
String @lpProcessInformation
DECLARE Integer ShellExecute IN Shell32 ;
Integer nHWnd, ;
String cOperation, ;
String cFile, ;
String cParameters, ;
String cDirectory, ;
Integer nShowCmd

* Initial settings

lcStartupInfo = CHR(65) + REPLICATE(CHR(0), 64)
lcProcessInfo = SPACE(16)
lcCompactFile = "f:\calendar\systems\systems.or3"
lcCompactExe = "c:\program files\lotus\organize\org3rb32.exe"
lcCommand = lcCompactEXE + " " + lcCompactFile
SET DEFAULT TO "c:\program files\lotus\compnent"

* CreateProcess (This fails.)

lnRetCode = CreateProcess(0, lcCommand, ;
0, 0, 0, 0, "", 0, @lcStartupInfo, @lcProcessInfo)
*** CreateProcess returns 1

* ShellExecute (This works.)

lnRetCode = ShellExecute(0, 0, lcCompactExe, lcCompactFile, "", 1)
DO ShowError WITH "ShellExecute"
*** ShellExecute returns 42
Next
Reply
Map
View

Click here to load this message in the networking platform