System.VarUtils.SafeArrayLock

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function SafeArrayLock; external oleaut name 'SafeArrayLock';

C++

extern "C" HRESULT __stdcall SafeArrayLock(System::PVarArray VarArray);

Properties

Type Visibility Source Unit Parent
function external public
System.VarUtils.pas
System.VarUtils.hpp
System.VarUtils System.VarUtils

Description

Locks a safe array.

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

VAR_OK

The operation was completed successfully.

VAR_INVALIDARG

The given argument is nil.

VAR_ARRAYISLOCKED

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.

See Also