Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Com object nesting
Message
 
To
08/05/2002 11:13:23
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00654027
Message ID:
00654082
Views:
22
>Is there a limit on how deep you can nest object calls? I have an object which calls other objects with no problems but when one of the called objects calls another object I get an error. If I move that object into the first object, it seems to work.

In addition to what Larry says, remember that for the performance sake it is necessary to reduce this nested references size.

Every dot operator within your COM object reference is actually a round-trip COM call throught the COM barriers.

If you need to call several methods from your deepest level COM it is better to assign it to a local variable (or property) Something like instead of
thisform.MyFirstCom.MySecondCom.MyThirdCom.SomeMethod1()
thisform.MyFirstCom.MySecondCom.MyThirdCom.SomeMethod2()
thisform.MyFirstCom.MySecondCom.MyThirdCom.SomeMethod3()
you should use
oCom3 = thisform.MyFirstCom.MySecondCom.MyThirdCom

oCom3.SomeMethod1()
oCom3.SomeMethod2()
oCom3.SomeMethod3()
or use
WITH thisform.MyFirstCom.MySecondCom.MyThirdCom
...

ENDWITH
The difference in the performance for such COM references in the above cases will be significantly bigger than the same in case of calling normal form objects.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform