Information générale
Catégorie:
Fonctions Windows API
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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement