Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCATTER in a COM Object
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00834954
Message ID:
00835480
Views:
20
>Claudio,
>
>I tried creating a class that has properties for all the fields. The class is based
>off of the Session class, and I use AddProperty to add the fields as properties to
>it.
>
>Again, it does run, but I cannot see any properties of any kind on the object
>when I run it.
>
>When I drag the variable into the Watch window, I see it as an Object, but there
>are no properties to expand and see.

Kevin,
This is because the act of returning an object from a COM object converts the object into a COM object. Try the following:

Create an array property in your returned object to hold the field names (and thereby the property names). Populate it after you do the SCATTER NAME inside your COM object. When you use AddProperty method to add the property, add an array element.

You will also need to store the length of the array in a property of the object. You will need this to access each element of the array and get the property value. You can use a FOR EACH loop but that sometimes causes problems with COM objects. It leaves internal references and causes memory leaks.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform