Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you call a PRG which returns a value?
Message
De
04/11/2011 10:33:14
 
 
À
03/11/2011 17:21:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01527979
Message ID:
01528060
Vues:
82
try just this.
lcPath = SET("PATH")
set path to Home(1)
if file(home(1)+"SCCTextX.prg")
     lnReturn = SCCTextX(lcFile)
else
     lnReturn = SCCText(lcFile)
endif 
set Path to &lcPath
The FoxPro folder is always on the path. Even if it is not in the SET PATH statement. Otherwise, copy the SCCText?.prg to the local project folder so the application can see it.

>I need to dynamically resolve the name.
>
>I look for the new SCCTextX.prg from VFPx first, and if it's present I use it, and if not, I default to original SCCText.prg
>
>
>
>lcSCCText = Home(1) + 'SCCTextX.prg' && Look for the enhanced one from VFPx.
>
>If !File(lcSCCText)
>	lcSCCText = Home(1) + 'SCCText.prg' && Use the original one that shipped with VFP
>EndIf
>
>lcFile = 'C:\MyCode\MyForm.scx'
>
>lnReturn = &lcSCCText(lcFile)
>
>
>
>
>So, it gives an error on the line:
>
>lnReturn = &lcSCCText(lcFile)
>
>
>
>
>
>
>.
>
>>What more do you need?
>>
>>>I'm working with the SCCText.prg that ships with FoxPro. It is nothing more than PRG.
>>>
>>>However, it inidcates that it returns a value.
>>>
>>>I assumed there was a way to call it so that you could capture that value.
>>>
>>>Kind of silly of VFP to ship with code that cannot even be used as advertised.
>>>
>>>
>>>.
>>>
>>>>Only a function call can return a value. See http://www.berezniker.com/content/pages/visual-foxpro/difference-between-function-and-procedure-statements
>>>>
>>>>lnReturn = Blah('SomeString'  )
>>>>
>>>>
>>>>>I have a prg that receives parameters and returns a value. It does not have "Procedure" line at the top, it's just code in a prg.
>>>>>
>>>>>The last line of the file returns a value with RETURN lnReturn
>>>>>
>>>>>So, how do you call a PRG in a way that you can capture the return value?
>>>>>
>>>>>I've tried stuff like:
>>>>>
>>>>>Do Blah.prg with 'SomeString' to lnReturn
>>>>>
>>>>>
>>>>>and other goofy attempts, but none have worked.
>>>>>
>>>>>What to do?
Greg Reichert
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform