extracting safearray from a variant
-
ok, I'm just starting to learn how to pass more complicated things from my C++ objects to vb (which I'm just starting to learn). Currently I can't seem to figure out how to get my safearray out of the variant passed through my callback interface. This safearray needs to be passed back through a callback interface ACROSS process boundaries (no passing by ref allowed). _____________________________________ the C++ side of this is as follows SAFEARRAY *saHashCodes; saHashCodes = SafeArrayCreateVector( VT_I4, 0, nNumHashCodes ); for ( U32 index = 0; index
-
ok, I'm just starting to learn how to pass more complicated things from my C++ objects to vb (which I'm just starting to learn). Currently I can't seem to figure out how to get my safearray out of the variant passed through my callback interface. This safearray needs to be passed back through a callback interface ACROSS process boundaries (no passing by ref allowed). _____________________________________ the C++ side of this is as follows SAFEARRAY *saHashCodes; saHashCodes = SafeArrayCreateVector( VT_I4, 0, nNumHashCodes ); for ( U32 index = 0; index
You should also specify the VT_I4
var.vt = VT_ARRAY | VT_I4;
In ServerLink_ReturnPrivateHashList function you can have your array in "saHashArray" parameter. It will be the array of Long (not Integer!) values. You can obtain any value from himDim i As Long i = saHashArray(0) ' or i = saHashArray(x), where x = 0,...,nNumHashCodes-1 ' or i = saHashArray(x), where x = LBound(saHashArray),...,UBound(saHashArray)
Or you can obtain whole array, but it's the same in it's usageDim arr() As Long arr = saHashArray
With best wishes, Vita -
You should also specify the VT_I4
var.vt = VT_ARRAY | VT_I4;
In ServerLink_ReturnPrivateHashList function you can have your array in "saHashArray" parameter. It will be the array of Long (not Integer!) values. You can obtain any value from himDim i As Long i = saHashArray(0) ' or i = saHashArray(x), where x = 0,...,nNumHashCodes-1 ' or i = saHashArray(x), where x = LBound(saHashArray),...,UBound(saHashArray)
Or you can obtain whole array, but it's the same in it's usageDim arr() As Long arr = saHashArray
With best wishes, Vita