Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ShellExecute Lost in Space?
Message
De
16/05/2011 14:54:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
ShellExecute Lost in Space?
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01510794
Message ID:
01510794
Vues:
134
Any ideas why this ShellExecute call works fine when called as highlighted lines in the Command Window like this:
lcHMISPath = 'C:\projects\csst\HMIS\'
lcFileName = 'export.csv'
RunAny(lcHMISPath + 'XML\CSST_HMIS.exe',,lcFileName)
But fails when called with this code from a menu procedure within a running application, where the laFiles[lnIndex,1] value is "export.csv"?
(CSST_HMIS.exe is an external procedure that is supposed to convert CSV to XML. It works fine in the first case, but simply pops up a DOS window and produces no output when called as shown below.)
		FOR lnIndex = 1 TO ALEN(laFiles,1)
			lcFileName = laFiles[lnIndex,1]
			WAIT 'Processing ' + lcFilename NOWAIT 
			 RunAny(lcHMISPath + 'XML\CSST_HMIS.exe',,lcFileName)

			DOEVENTS 
			Sleep(1000)
		ENDFOR 
Both call the same "RunAny" sub:
*===================================================
*
FUNCTION RunAny
*
LPARAMETERS tcExecutableFileName,tcOperation,tcParms,tcWorkDir
*
IF EMPTY(tcExecutableFileName)
	RETURN .F.
ENDIF

tcOperation = IIF(EMPTY(tcOperation),'open',tcOperation)
tcParms = IIF(EMPTY(tcParms),'',tcParms)
tcWorkDir = IIF(EMPTY(tcWorkDir),'',tcWorkDir)

DECLARE INTEGER ShellExecute ;
IN SHELL32.DLL ;
INTEGER nWinHandle,;
STRING cOperation,;
STRING cFileName,;
STRING cParameters,;
STRING cDirectory,;
INTEGER nShowWindow

RETURN ShellExecute(0,tcOperation,tcExecutableFileName,tcParms,tcWorkDir,1)
*
*====================================================
Ray Roper
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform