Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class vs DLL
Message
From
20/09/2004 18:27:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00944057
Message ID:
00944318
Views:
21
This message has been marked as the solution to the initial question of the thread.
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform