I'm writing simple c# app.
It's really simple. c# app calls activeX function with byte array as parameter, and then, activeX receives byte array and presents it.
I'm asking, Which data type I have to use in MFC ActiveX? Variant? Variant*?
Any help will be appreciated. Thanks.
A VARIANT
of type VT_ARRAY|VT_UI1
. Code sample:
char original_buffer[1024];
SAFEARRAY FAR* psa;
SAFEARRAYBOUND rgsabound[1];
// fill original_buffer here
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1024;
psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
void* p=(char*)psa->pvData;
if (psa)
{
VARIANT variant_buffer;
VariantInit(&variant_buffer);
variant_buffer.vt = VT_ARRAY|VT_UI1;
variant_buffer.parray = psa;
void* p = (char*)psa->pvData;
memcpy(p, (void*)original_buffer, 1024);
// do someting with the array here
SafeArrayDestroy(psa);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.