Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ShellExecute result codes
Message
From
18/06/1998 19:54:32
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00108874
Message ID:
00109755
Views:
51
David,

We have a function called PrintForm that issues the following line of code:

liResult=DoShell("OPEN", "\FOX\FPRINT.EXE", lcPrintCmd, "", 0)

Of course, DoShell() is another function that issues:

DECLARE INTEGER ShellExecute IN Shell32;
INTEGER @HWND,;
STRING @lpOperation,;
STRING @lpFile,;
STRING @lpParameters,;
STRING @lpDirectory,;
INTEGER @nShowCmd

DECLARE LONG GetDesktopWindow IN WIN32API

LOCAL hWind, liResult

IF PARAMETERS() < 4 THEN && lcDirectory was not passed in.
&& Set default directory.
lcDirectory = "C:\"
ENDIF
IF PARAMETERS() < 5 THEN && liShowCmd was not passed in.
&& By default, we hide the command window.
liShowCmd = 0
ENDIF
IF PARAMETERS() < 6 THEN && llTellMe was not passed in.
&& By default, we don't explicitly notify user of the result.
llTellMe = .F.
ENDIF

hWind = GetDesktopWindow()

lcDirectory=lcDirectory+CHR(0) &&NULL-terminate the string.

&& Returned value >32 means operation successful
liResult = ShellExecute(@hWind,@lcOperation,@lcFile,@lcParameters,@lcDirectory,liShowCmd)

IF llTellMe THEN
IF liResult > 32 THEN
WAIT WINDOW "Operation Successful"
ELSE
WAIT WINDOW "Operation Encountered Problems: Code " + STR(liResult)
ENDIF
ENDIF

CLEAR DLLS
RETURN liResult

The strange thing is that this code works like a charm here in dev, but fails with a result code of 5 (access denied) in testing environments.

Thanks,

--Bruce
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform