I need to use properties with handles embedded NULL chars in an ACTIVEX
control generated with VC++ 6.0.
Can you give me a sample ?
DISP_PROPERTY_EX(CProduct, "Read", GetRead, SetRead, ???) // <- what
to place to handle a BSTR*
BSTR CProduct::GetRead()
{
????? // <- what to place to handle a BSTR*
}
void CProduct::SetRead(????? lpszNewValue)
{
????? // <- what to place to handle a BSTR*
SetModifiedFlag();
}
Thank you,
Michael
Michael,
You need to define your calls to pass a variant rather than a string. The
variant would be an array of (say) bytes. Check out COleSafeArray.
Rick
Can you give me a sample ?
Regards,
Michael
Rick Murtagh <ri...@nextwave.net> a écrit dans le message :
pyzg5.66141$i5.10...@news1.frmt1.sfba.home.com...
In the OCX container, send data so:
COleSafeArray safearray;
// Set the safearray as 1000 unsigned bytes
safearray.CreateOneDim(VT_UI1, 1000);
// Get a pointer to the data area
void *pData = NULL;
safearray.AccessData(&pData);
// manipulate the data array however you want
ZeroMemory(pData, 1000);
// Release the data area. pData is no longer valid.
safearray.UnaccessData();
m_EQ.SetData(*(LPVARIANT) safearray);
In the control, SetData is defined thus:
[id(1)] void SetData(VARIANT vData);
And implemented:
void CEQCtrl::SetData(const VARIANT FAR& vData)
{
COleSafeArray safearray(vData);
// whatever
}