Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ShellExecute Failing
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
01025967
Message ID:
01025987
Vues:
10
It's a good idea to check wether both the file and the folder exists..
Have you done it?


>>c:\program files\mcmtv\spotdata\spotdata.exe
>>and
>>c:\program files\mcmtv\spotdata
>
>Perhaps the spaces in the path, try using
>
>"c:\program files\mcmtv\spotdata" with the quotes.
>
>
>
>>Not sure about this.
>>
>>Return code 2, in your code, is a bad URL. I'm passing:
>>
>>c:\program files\mcmtv\spotdata\spotdata.exe
>>and
>>c:\program files\mcmtv\spotdata
>>
>>Neither of these is a URL
>>
>>
>>
>>>>I have the following code. It had worked forever with no problems.
>>>>Today I failed. The ShellExecute function is now returning 2.
>>>>
>>>>How do I find out what this '2' represents?
>>>>
>>>>
>>>>LPARAMETERS cApplication, cStartFolder, cParamString
>>>>
>>>>	LOCAL iRetVal
>>>>
>>>>	IF EMPTY(cParamString)
>>>>		cParamString = ""
>>>>	ELSE
>>>>		cParamString = '"' + cParamString + '"'
>>>>	ENDIF
>>>>
>>>>	IF EMPTY(cStartFolder)
>>>>		cStartFolder = ""
>>>>	ENDIF
>>>>
>>>>	DECLARE INTEGER GetDesktopWindow IN WIN32API
>>>>	>	DECLARE INTEGER ShellExecute IN shell32;
>>>>	    INTEGER hwnd,;
>>>>	    STRING  lpOperation,;
>>>>	    STRING  lpFile,;
>>>>	    STRING  lpParameters,;
>>>>	    STRING  lpDirectory,;
>>>>	    INTEGER nShowCmd
>>>>
>>>>	hWnd = GetDesktopWindow()
>>>>
>>>>	iRetVal = ShellExecute(hWnd, "open", cApplication, cParamString , cStartFolder, 5)
>>>>
>>>>RETURN
>>>>
>>>>
>>>
>>>
>>>Here the code I use for ShellExecute
>>>
>>>   DECLARE INTEGER ShellExecute IN SHELL32.DLL INTEGER nWinHandle,;
>>>                                               STRING cOperation,;
>>>                                               STRING cFileName,;
>>>                                               STRING cParameters,;
>>>                                               STRING cDirectory,;
>>>                                               INTEGER nShowWindow
>>>    result = ShellExecute(hWnd, "open", cExtention, cParams, cFolder, 5)
>>>    DO CASE
>>>       CASE result ==  0         && The system is out of memory or resources.
>>>            msg = "The system is out of memory or resources."
>>>       CASE result ==  2         && Bad Association (for example, invalid URL)
>>>            msg = "invalid URL"
>>>       CASE result == 29         && Failure to load application
>>>            msg = "Fail to load application"
>>>       CASE result == 30         && Application is busy
>>>            msg = "Application is busy"
>>>       CASE result == 31         && No application association
>>>            msg = "No application association"
>>>   ENDCASE
>>>   IF INLIST(result, 0, 2, 29, 30, 31)
>>>      MessageBox(msg, 0 + 64, "Error")
>>>   ENDIF
>>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform