RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
VarUtils.SafeArrayCopy Function

Copies a safe array to another.

Pascal
function SafeArrayCopy(SourceArray: PVarArray; out TargetArray: PVarArray): HRESULT; stdcall;
C++
__stdcall HRESULT SafeArrayCopy(PVarArray SourceArray, PVarArray TargetArray);

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

 

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