RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
VarUtils.SafeArrayCopyData Function

Copies the data from a safe array to another.

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

Use SafeArrayCopyData to copy over the data from the safe array given through SourceArray to the safe array stored in TargetArray.  

In order to copy the data from the safe array, SafeArrayCopyData first checks if the source array is valid and also establishes that the source and target arrays are compatible. SafeArrayCopyData then locks the source array, clears up the data in the target array, and copies over the data from the source array. Finally, the source array is unlocked.  

If SafeArrayCopyData managed to copy over the data from the source array, then TargetArray contains the copied data. If the two arrays are incompatible, SafeArrayCopyData returns a VAR_INVALIDARG value. Otherwise, it returns VAR_OK 

 

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