>Hi,
>I have a class called Format_Prices with a parameter statements up at top like this
>parameters MyPrice
>.... the program
>return MyPrice
>
>? myClass.FormatPrice("12.98749")
>
>When I use this class to format prices within a vfp it works great. However, if I
>build this class into a VFP DLL, I run into the following problem:
>The line with the "parameters MyPrice" returns an error Code 16 error in this line.
>If I remove the parameter statement, then build the DLL, it works.
>
>Do I need the "parameters myPrice" statement or don't I? Why would
>
>Thanks Steve
Steve,
When doing COM DLLs follow this skeleton:
define class ... as ... olepublic
Procedure Format_Price(InputParameter1 as < datatype >,InputParameter2 as < datatype >,...) as < returndatatype >
endproc
enddefine
(InputParameter1 as < datatype >,InputParameter2 as < datatype >,...) following procedure name are parameters and thus replace parameters or lparameters line.
You'd remember this sample class:
DEFINE CLASS testclass as Session olepublic
Datapath = "C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 7\SAMPLES\DATA"
PROCEDURE GetCustomerAmt(tcCustomerID as String) as Currency
LOCAL ARRAY aMaxAmt[1]
SELECT maxordamt ;
FROM (ADDBS(this.DataPath)+"customer") ;
WHERE cust_id == UPPER(m.tcCustomerID) ;
INTO ARRAY aRetVal
return IIF(_Tally>0,aRetVal,NTOM(0))
ENDPROC
PROCEDURE TimePlease() as Datetime
RETURN DATETIME()
endproc
enddefine
Here:
PROCEDURE GetCustomerAmt(tcCustomerID as String) as Currency
Could be like:
PROCEDURE GetCustomerAmt(tcCustomerID)
It's same as saying:
PROCEDURE GetCustomerAmt
lparameters tcCustomerID as String
or:
PROCEDURE GetCustomerAmt
lparameters tcCustomerID
For OLEPUBLIC use the form with parentheses (documented somewhere). Types are not mandatory.
Cetin