John Baird
Coatesville, Pennsylvania, United States
General information
Category:
COM/DCOM and OLE Automation
This will not work in a DLL But check out the function ComArray() Assuming you are using VFP7
>Okay guys:
>
>I start with this class:
>
>
>DEFINE CLASS testarray AS line
>
> FUNCTION getList()
> loObj = NEWOBJECT('line')
> loObj.AddProperty('aList(1,3)', '')
>
> SELECT lname, fname, cust_id ;
> FROM customer ;
> INTO ARRAY loObj.aList
>
> RETURN loObj
> ENDFUNC
>ENDDEFINE
>
>
>which I call like this from a program:
>
>---------------------------------------------
>set procedure to testarray
>o = createobject('testarray')
>x = o.getlist()
>
>?ALEN(x.aList, 1)
>
>FOR EACH oItem IN x.aList
> ? oItem
>ENDFOR
>
>--------------------------------------------
>
>
>Everything works fine, but if I do this as a dll:
>
>
>----------------------------------------------
>DEFINE CLASS Customer AS SESSION OLEPUBLIC
>
> FUNCTION getList()
> loObj = NEWOBJECT('line')
> loObj.AddProperty('aList(1,3)', '')
>
> SELECT lname, fname, cust_id ;
> FROM customer ;
> INTO ARRAY loObj.aList
>
> RETURN loObj
> ENDFUNC
>ENDDEFINE
>----------------------------------------------------
>
>and then try to access it:
>
>
>o = CREATEOBJECT("libs.Customer")
>x = o.GetList()
>
>?ALEN(x.aList, 1)
>
>FOR EACH oItem IN x.aList
> ? oItem
>ENDFOR
>------------------------------------------------------
>
>I get all kinds of errors: it doesn't recognize x.alist as an array. What do I need to do so it does?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only