Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create cursor from object (GATHER NAME on steroid
Message
 
To
05/03/2006 22:03:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01101568
Message ID:
01246810
Views:
19
Hi Alejandro,

> It's as if you are looking at a proxy object that only gets properties added as they are discovered some other way.

That's pretty close... With a COM object you have two ways to get properties. First of all, a COM object can provide a type library. This library can be available either external as a TLB file, or be built into the COM object. The other way is called IDispatch. Basically, this means that VFP calls a particular method passing a name of a property or method. The COM object either returns an ID for this property or an error code if the property doesn't exist. VFP caches the result of these calls. So whenever you access a property for the first time, it gets added to the list of properties. Of course, you have to know the name first...

The type library access method has another gotcha. There's a COM call to access a type library. However, you need to make this call on the same object that you want to access a property on to get any meaningful result. In VFP this can cause problems when the object is apparently the result of a method call which is the case for arrays and collections. Hence, something like:
AMEMBERS(laPEM, loCOM.Folders(1).Item(1), 3)
might fail, whereas the following could work:
loItem = loCOM.Folders(1).Item(1)
AMEMBERS(laPEM, loItem, 3)
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform