Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP and COM objects
Message
From
23/07/1998 09:14:59
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
 
 
To
21/07/1998 09:09:54
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00117378
Message ID:
00120399
Views:
32
>>>>>As I understand it the limitations encountered are related to the general architecture of VFP6 and that is why they won't be changed in this version. For example, the internals of VFP would need to be greatly modified to change the way VFP handles arrays in order to allow safearrays.
>>>
>>>How about illuminating some of us... What is a safe array? And, if you are using VFP to talk to a VFP com object, why do you need to use them?
>>>
>>>BOb
>>
>>Obviously, it's an array that isn't dangerous, BOb :-)
>
>OH... I thought it was...
>
>1. An array that was wearing protection
>
>2. An array that didn't want to make a comitment
>
>Thanks for the info.
>
>BOb

A safearray is what you use to keep a large valuable object thats to big to fit in just one safe.

Actually, as we all know, C++ stongly types variables, unlike VFP that allows us to change a variable type at will at run time. A safearray allows an array to contain various data types instead of being only short ints, chars, etc. MS recommends using safearrays to pass data between COM objects and therefore many(or at least the ones I must interact with) component builders specify using them. For example, for an application I am building for a client, I have to call methods on servers written in C++ that require one or more pointers to safearrrays of chars that the method will redimension and fill with bytes as a way of my getting the data from the server. Example:

DIME myarray1[1]
DIME myarray2[1]
oServer = CreateObject("thirdparty.serverclass")
nRetVal = oServer.GetData(nKey,@myarray1,@myarray2)

VFP5 just won't do that. It can receive a safearray from a C++ or VB client just fine but I can't call servers the same way. VFP6 claims to allow passing arrays to COM objects by ref with COMARRAY(). I tried it and was unable to pass an array to a server expecting a safearray. I hope that either I did something wrong or that the release version will support safearrays.

Gary Foster
Pointsource Consulting Inc.
gary_foster@starkey.com
Previous
Reply
Map
View

Click here to load this message in the networking platform