Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass an array to a VFP COM Object
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00191796
Message ID:
00193049
Views:
17
>I've run into all sorts of problems where I've needed to pass an array of char with embedded nulls to a VFP COM object; if I stick an array of char into a property, I don't run into the same problems I have when passing the array of char as a parameter. I don't know why I have the problem, but it's bitten me a couple of times in an object that I use for one of my routing servers. If I could reliably pass an array of char to VFP by reference and get it back resized, I'd be a much happier camper - what I do now is pass in the list of known intermedite points, and then read a property on return to get the adjusted route.

I think the problem has more to do with how Variant strings are handled
by VFP. You can't use VB/C++ type ByteArrays with VFP over COM- only true SafeArrays that have variant BSTR values. If you use those they
should work fine with VFP.

Binary data in strings is always a problem <s> - but VFP handles this data
fine usually - it's most string classes (especially the COM _bstr_t and
_variant_t classes) that don't handle binary strings properly. Make sure
your data actually contains what you think it does before it goes to
VFP.

Finally, try different combinations of the COMARRAY() function to get the
passing by value/reference and 0 or 1 based nature of the array right for
the object.

>Yes, I am aware that an assignment is a method call that actually invokes the necessary marshalling needed to pass stuff across a process (or even at times across a thread) boundary. Maybe I'm doing something dumb.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform