MSComm, Variant and ByteArray...
Here is the code I use:
CByteArray InArray;
COleVariant VarIn;
void* pArrayData;
VarIn=m_MSComm2.GetInput();
InArray.SetSize(VarIn.parray->rgsabound[0].cElements);
SafeArrayAccessData(VarIn.parray, &pArrayData);
memcpy(InArray.GetData(), pArrayData, InArray.GetSize());
SafeArrayUnaccessData(VarIn.parray);
When I trace the program, I see as expected, 3 Bytes in VarIn. On the other hand, "VarIn.parray->rgsabound[0].cElements" returns junk (-1414812757 which is quite different from 3).
Does anyone knows what I'm doing wrong ?

