Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Run external program and pass parameter
Message
De
09/01/2015 09:34:41
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01613348
Message ID:
01613349
Vues:
56
>Hello,
>
>I am trying to run a Telerik Report from withing my VFP8 /SP1 desktop application. I can get the Report to open; however, I am having difficulty passing the GUID value as a parameter.
>
>This command works to open the report: RUN /n &lcProgram &lcReport Case_ID lcCID
>The lcProgram variable is the path to the Telerik Report Program.
>The lcReport variable is the path to the actual Telerik Report.
>Case_ID is the Telerik Report Parameter.
>lcCID is the Telerik Report Parameter Value.
>
>When I run the above command, the Telerik Report viewer opens and "lcCID" is in the parameter value field. The report is blank. (I need the value of lcCID which is "AFD6E102-944B-3D4F-B697-5731D8D267F3."
>
>If I manually past the lcCID GUID value into the parameter value field after the Telerik Report opens, the report displays just fine.
>
>Question: How do I pass the lcCID GUID value (AFD6E102-944B-3D4F-B697-5731D8D267F3) to the Telerik report in plain text?
>
>I have played with various scenarios with no luck:
>-- Error -- RUN /n &lcProgram &lcReport Case_ID &lcCID
>-- Error -- RUN /n &lcProgram &lcReport Case_ID "AFD6E102-944B-3D4F-B697-5731D8D267F3"
>-- Error -- RUN /n &lcProgram &lcReport Case_ID AFD6E102-944B-3D4F-B697-5731D8D267F3
>-- Error -- RUN /n &lcFullPath Case_ID lcCID
>-- Error -- RUN /n &lcFullPath Case_ID "AFD6E102-944B-3D4F-B697-5731D8D267F3"
>-- Error -- RUN /n &lcFullPath Case_ID AFD6E102-944B-3D4F-B697-5731D8D267F3
>-- Error -- RUN /n &lcFullPath &lcCaseID
>-- Error -- RUN /n &lcProgram &lcReportNP Case_ID &lcCID
>-- Error -- RUN /n &lcProgram &lcReportNP Case_ID "AFD6E102-944B-3D4F-B697-5731D8D267F3"
>-- Error -- RUN /n &lcProgram &lcReportNP Case_ID AFD6E102-944B-3D4F-B697-5731D8D267F3
>
>Any ideas of what to try next?
>
>Thanks,
>TFISHER

No need for Run, Shellexecute is far better.
lcProg = fullpath(lcProgram)
lcPar = textmerge(<<lcReport>> Case_ID <<lcCID>>)
Shellx(lcProg, lcPar)
*ShellX.prg:
*To use:
*
*lcProg = 'Yourpath\yourprog.exe'
*lcPar = 'some parameters' && Drop this line if no parameters
*ShellX(lcProg, lcPar)
Lparameters tcURL, tcParameter
if empty(tcParameter)
   tcParameter = ''
Endif
#define SW_HIDE 0
#DEFINE SW_SHOWNORMAL 1
#DEFINE SW_SHOWMINIMIZED 2
#DEFINE SW_SHOWMAXIMIZED 3
*!*   Legal verbs: open, edit, print, find, explore, NULL
DECLARE INTEGER ShellExecute IN shell32.dll ; 
   INTEGER hndWin, STRING cAction, STRING cFileName, ; 
   STRING cParams, STRING cDir, INTEGER nShowWin
ShellExecute( 0, "open", tcURL, tcParameter , "", SW_SHOWNORMAL )
Update: If there's spaces it the path, you must add apostrophes, like this
lcPar = textmerge("<<lcReport>>" Case_ID <<lcCID>>)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform