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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array and Com Object

Status
Not open for further replies.

foxteam1

IS-IT--Management
Jul 28, 2006
8
Hi

I try to convert a VBA (Access 2000) function using a Comm Object (from Borland C++ 6) to VFP9.
This "function" use an array by address like this in VBA:

DIM mayarray as Long
myarray(0)=1127789
i as Int
i=1
oCom.LauchMacro( i , myarray() ) ==> works

But in VFP

i=1
Public array myarray(1)
myarray(1)=1127789
oCom.LauchMacro( i , myarray() ) ==>not working and display no error
I try
oCom.LauchMacro( i , @myarray() ) ==>error (subscript...)

Any idea, thanks

Franck




 
I do not know what "com" does but you need to create the array first

Public myarray
dimension myarray(1)
myarray(1)=1127789

"oCom.LauchMacro( i , @myarray() ) ==>error (subscript...)"

I am guessing here: Try

oCom.LauchMacro( i , @myarray)



 
Franck,

In addition to Imaginecorp's good advice, keep in mind that VFP arrays' are one-based, whereas the COM object might be expecting it to be zero-based. If you think that's an issue, check the Help for COMARRAY().

Also, be cautious about COM objects that re-dimension the array. If that's likely to happen, make sure your DIMENSION the array to its largest likely size.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top