Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get an array from a com object?
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00520366
Message ID:
00520617
Views:
16
We ran into this on a COM server we were working on. In order to do it, I added a method to the COM server COMGetProp() to return a given property. Since the COM server doesn't share the same memory location, it can't. So we had to do something like this below...
In the COM Server, a 2 parameter array.  First the property, second the element

function COMGetProp
   lparameters vcPropName, vnElement

   */ test for valid object property and element
   if pemStatus( This, vcPropName, 5 )
      */ Valid property... return that value
      return  eval( "This." + vcPropName + "[" + allt( str( vnElement )) + "]" )
   else
      */ property not found...
      return "invalid property/array value..."
   endif
endfunc



On the client side...

*/  Assume object goCOM is an instance of your COM server object
dimension laLocalCopy[5]

for lnI = 1 to 5
  laLocalCopy[lnI] = goCOM.COMGetProp( "YourCOMArrayProp", lnI )
endfor
Of course, if you had a multi-dimensional array, you would have to alter the COMGetProp() method to accommodate, but at least this is a baseline approach you could try.

HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform