System.Variant.ArrayLock

From RAD Studio API Documentation
Jump to: navigation, search

C++

Pointer __fastcall ArrayLock();

Properties

Type Visibility Source Unit Parent
function public sysvari.h System Variant

Description

Locks the given variant array and returns a pointer to the data stored in the array.

While locked, a variant array cannot be resized and any calls to ArrayRedim fail. Once locked, a variant array must later be unlocked using ArrayUnlock. An EVariantError exception is raised if the variant given by A is not an array.

The pointer returned by ArrayLock points to an array of elements in which the leftmost dimension increases first. In other words, the dimensions of the returned array pointer are reversed from the dimensions of the variant array.

Once it is verified that a variant array has the correct bounds and dimensions, ArrayLock can be used to gain direct access to the array data, which results in much improved performance.

See Also