Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ShellExecute result codes
Message
 
 
À
18/06/1998 19:54:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00108874
Message ID:
00109758
Vues:
48
Bruce,

A couple of more things. Can the test machine run the command in a regular old DOS window? The HWND and nShowCmd are not sent by reference. And your ShellExecute call you don't pass liShowCmd by ref. In my wrapper class I just declare the other args as string instead of string references, and pass object parameters without chr(0) terminating them. If you haven't downloaded spyin.zip from my website you might give the wrapper class a try just to see.

>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
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform