Compartir a través de


Passing Arrays

A Visual FoxPro function, COMARRAY( ), makes it possible for you to specify how an array is passed to an automation server, and makes it possible for you to specify whether the array is zero or one-based.

Earlier versions of Visual FoxPro passed arrays to COM objects (such as Automation servers created in Visual FoxPro, Visual Basic, or Visual C++) by value; the array elements were the same after a method call, and the COM object changes weren't propagated to the elements on the client. This restriction prevented passing large amounts of data back and forth between Visual FoxPro and COM objects.

The array passed to the COM object is assumed to be a one-based array, meaning that the first element, row, or column in the array is referenced with 1 (for example, Myarray[1]). However, some COM objects require that the array passed is zero-based (the first element, row, or column in the array is referenced with 0; for example, Myarray[0]).

Note   COMARRAY( ) is used only when arrays are passed to COM objects using the following syntax:

oComObject.Method(@MyArray)

If you omit the @ token, only the first element of the array is passed to the COM object and COMARRAY( ) has no effect. This behavior is the same behavior as in earlier versions of Visual FoxPro.

See Also

Interoperability and the Internet | Compiling Source Code | COMARRAY( )