Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass Vfp Object to a DCOM server ?
Message
From
02/08/2000 17:48:17
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00399459
Message ID:
00400101
Views:
47
>IOW, you're stating that I can create a variant in VBA, pass it by reference, assign a VFP object reference to it in a VFP COM object, and it is resolved internally by Excel?

Try it, it works. It's enough to testwith VF as a client to a VFP COM server. A simple method is enough:

oObject = CREATEOBJECT("Custom")
RETURN oObject

>This doesn't sound like it would work. If the dynamic object that got created were defined as OLEPUBLIC, then it'd be a COM object, and the reference passed would be resolved through the COM interface.

My guess is that VFP does the packaging on the fly when the object gets returned over COM. Possibly COM servers know to implement IUnknown in objects it returns from methods?

FWIW, the same works for an object attached to a a server property:

THIS.SomeProperty = CREATEOBJECT("Custom")

You can then reach the custom object from the client like

?oServer.SomeProperty.Name


>A VFP object shouldn't move across the COM boundary, any more than an open datasession would.

I'm pretty sure that this is inaccurate, because VFP appears to handle it. Datasessions don't have a reasonable COm facsimile, objects do.


> If what you're saying worked as described, then the entire VFP memory model would be opened to Excel;

Not if Excel delegates the object resolution to the server, and lets the server deal with it. Even across COM boundaries, the objects are still passed by reference:

oServer = CREATEOBJECT("MyCOMSErver.Server")
oNewObject = oServer.ReturnObject() && say ReturnObject attaches the new object ot a property as well as returns a reference to it

oNewObject.Tag = "Howdy"

?oServer.ObjectReference.Tag && Returns "Howdy"

> getting at the content of an object involves working through several layers of the NTI (the Name Table used internally by VFP to resolve the names of things within the VFP environment) which isn't done except through use of the Fox API.

Right. But like I said above, Excel doesn't have to do this if it leaves it up to the VFP server to handle the resolution.

> in theory, you should be able to use the same mechanism to return a reference to _SCREEN or _VFP to the Excel VBA code and have Excel navigate the reference, including references to other objects inside VFP.

This works too. :-)
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform