Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HOWTO : Insert a property which handles embedded NULL chars in an ACTIVEX generated with VC++ 6.0

8 views
Skip to first unread message

Michael RENARD

unread,
Jul 29, 2000, 3:00:00 AM7/29/00
to
Hi,

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

Rick Murtagh

unread,
Jul 29, 2000, 3:00:00 AM7/29/00
to
In article <8lu2ih$li3$1...@news1.skynet.be>, "Michael RENARD" <michael...@win.be> wrote:
>I need to use properties with handles embedded NULL chars in an ACTIVEX
>control generated with VC++ 6.0.

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

Michael RENARD

unread,
Jul 30, 2000, 3:00:00 AM7/30/00
to
Dear 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...

Rick Murtagh

unread,
Jul 30, 2000, 3:00:00 AM7/30/00
to
In article <8m0i9o$68v$1...@news0.skynet.be>, "Michael RENARD" <michael...@win.be> wrote:
>Dear Rick,
>
>Can you give me a sample ?
>
>Regards,

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
}

0 new messages