System.VarUtils.SafeArrayCopy

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function SafeArrayCopy; external oleaut name 'SafeArrayCopy';

C++

extern "C" HRESULT __stdcall SafeArrayCopy(System::PVarArray SourceArray, /* out */ System::PVarArray &TargetArray);

Properties

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

Description

Copies a safe array to another.

Use SafeArrayCopy to create a copy of the safe array given through SourceArray to the safe array stored in TargetArray.

In order to copy the safe array, SafeArrayCopy first checks if the source array is valid. SafeArrayCopy then locks the source array, allocates memory for the descriptor and for the actual data of the target array, and copies over the data from the source array to the target array. Finally, the source array is unlocked.

If SafeArrayCopy managed to copy the source array, then TargetArray contains the copied array. If SafeArrayCopy did not manage to copy over the safe array, it simply sets the TargetArray parameter to nil.

See Also