Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending array of information from VFP to Delphi

Status
Not open for further replies.

tryn2learn

Programmer
Jun 26, 2000
24
US
I'm trying to send an array of information from VFP 7.0 into a Delphi object. My problem is that Delphi uses zero based arrays. I have successfully used the COMARRAY when receiving an array of information from Delphi, however I have not been successfull in sending it to Dephi in the proper format for Delphi to read it.
 
Which is the COM object, the Delphi Object or the VFP object?
 
I'm not the owner of the Delphi code and cannot change the way it is written. The Delphi code is requiring that the information is to be passed in as a parameter in an array.
 
Hmm. I don't know the structure of a COM array, however if you can figure it out, byte for byte, then you could use my Struct class at to build it as a binary structure in a string, then just pass the string.

Since it's a COM object, there may be type checking that will make this approach fail, but it works very well with API function calls.

What are the items in the array?

if they are all integers, it would be something like this:
Code:
xx= create('myDelphiArr')
cArr = xx.Structure

oDel = CREATE('theDelphi.ComObject')
oDel.MethodThatNeedsArray( cArr )


DEFINE CLASS myDelphiArr AS Struct
  PROCEDURE Init
    THIS.AddField('Arr[1]', 'INTEGER', 1 )
    THIS.AddField('Arr[2]', 'INTEGER', 1 )
    THIS.AddField('Arr[3]', 'INTEGER', 1 )
    THIS.AddField('Arr[4]', 'INTEGER', 1 )
    THIS.AddField('Arr[5]', 'INTEGER', 1 )
  ENDPROC
ENDDEFINE
 
It seems that the COMARRAY() function in VFP is designed for sending an array by reference to a COM object's method, not for receiving arrays from a COM object, so I don't understand what you say you've accomplished using it... it seems to be designed to do exactly what you need.
 
I wasn't clear in my original posting. I have successfully received information from Delphi in an array format. However, I've tried the COMARRAY() in this situation, but it hasn't been successful. The array contains text. I'm passing field names & their values.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top