Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with passing a parameter to a DLL init proc
Message
 
 
À
07/02/2005 22:04:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Divers
Thread ID:
00984631
Message ID:
00984633
Vues:
16
You cannot pass parameters to a COM DLL Init. You can add another method, say SetRatePath, to do the same.

>I have a DLL that had a procedure that accepted an XML string. My users now want to send a string containing a path before calling the XML proc. I want to have an INIT procedure in my class and allow it to accept a string, then set that to a variable that the procedure accepting the XML can use.
>
>My class is defined as CALC_FI and it's in CALC_FI.DLL The main procedure is Calc_pmt. I have added an Init procedure that should accept the path string, then place it into a protected variable called cRatePath, to be used by Calc_pmt when needed.
>
>My problem is that I am unable to use CREATEOBJECT anymore. Without the Init procedure, I could previously use CREATEOBJECT("calc_fi.calc_fi") and then later call the calc_pmt procedure in the class. With the Init procedure accepting a parameter, the CREATEOBJECT("calc_fi.calc_fi","C:\") fails. If I use NEWOBJECT("calc_fi","calc_fi.prg",NULL,"C:\"), everything works fine.
>
>I want to use Createobject, but can't. Is there something I am missing?
>
>Here's the class
>
>DEFINE CLASS calc_fi AS CUSTOM OLEPUBLIC
>
>PROTECTED cRatePath
>cRatePath = NULL
>
>Procedure Init (tcRatePath)
>This.cRatePath = tcRatePath
>Endproc
>
>Procedure Calc_pmt (cXml as String) AS String
>
>blah, blah...use This.cRatepath to set a path
>
>Endproc
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform