RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
VarUtils.SafeArrayLock Function

Locks a safe array.

Pascal
function SafeArrayLock(VarArray: PVarArray): HRESULT; stdcall;
C++
__stdcall HRESULT SafeArrayLock(PVarArray VarArray);

SafeArrayLock locks the safe array given through the VarArray parameter. VarArray is a pointer to the safe array.  

The possible return values of SafeArrayLock are listed in the following table, together with their meaning.

Value 
Meaning 
The operation was completed successfully. 
The given argument is nil
The array given through VarArray is locked. 

While locked, a safe array cannot be resized and any calls to SafeArrayRedim fail. Once locked, a safe array must later be unlocked using SafeArrayUnlock.  

If the locking operation succeeded, VarArray 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 safe array.

Tip: Once SafeArrayLock verifies that the safe array has the correct bounds and dimensions, SafeArrayLock can be used to gain direct access to the array data, which results in improved performance.
 

 

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