RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
Variant::ArrayLock Method

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

Pascal
function ArrayLock: Pointer;
C++
__fastcall Pointer ArrayLock();

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

The pointer returned by System::Variant::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, System::Variant::ArrayLock can be used to gain direct access to the array data which results in much improved performance. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!