Karl Blessing
Programmer
I've solved those problems or least found an alternative, instead of using a safearray or a linked list to hold in memory, I am using a CByteArray which grows as you add bytes into it, and holding it in there, and as far as getting out to visual basic, I have this exposed method that copies a CByteArray To A Variant and passes back out the Variant, which is seen in VB as a Variant/Bytes (Helpful to all of those that want to export binary data to VB)<br><br><br>VARIANT CWiDataClientCtrl::GetFileMem()
{
VARIANT vaResult;
VariantInit(&vaResult);
CByteArray MyB;
if (m_dclient.GetCByte(MyB) == 0)
{
vaResult.vt = VT_ARRAY ¦ VT_UI1;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].cElements = MyB.GetSize();
rgsabound[0].lLbound = 0;
vaResult.parray = SafeArrayCreate(VT_UI1, 1, rgsabound);
void * pArrayData = NULL;
SafeArrayAccessData(vaResult.parray, &pArrayData);
memcpy(pArrayData, MyB.GetData(), MyB.GetSize());
SafeArrayUnaccessData(vaResult.parray);
return vaResult;
}
vaResult.vt = VT_EMPTY;
return vaResult;
}<br><br>Though I would like sugestions on other methods or ideas you may have. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)
{
VARIANT vaResult;
VariantInit(&vaResult);
CByteArray MyB;
if (m_dclient.GetCByte(MyB) == 0)
{
vaResult.vt = VT_ARRAY ¦ VT_UI1;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].cElements = MyB.GetSize();
rgsabound[0].lLbound = 0;
vaResult.parray = SafeArrayCreate(VT_UI1, 1, rgsabound);
void * pArrayData = NULL;
SafeArrayAccessData(vaResult.parray, &pArrayData);
memcpy(pArrayData, MyB.GetData(), MyB.GetSize());
SafeArrayUnaccessData(vaResult.parray);
return vaResult;
}
vaResult.vt = VT_EMPTY;
return vaResult;
}<br><br>Though I would like sugestions on other methods or ideas you may have. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)