Hello guys!

Im new in C++ programing, and I want to
get and put same data in my COM.
I dont have problems with basic data types.

My IDL:

[propget, id(FW_DISPID_OFFSET), helpstring("property Offset")] HRESULT Offset([out, retval] short *pVal);
[propput, id(FW_DISPID_OFFSET), helpstring("property Offset")] HRESULT Offset([in] short newVal);

My Cpp:

STDMETHODIMP CYslider::get_Offset(short *pVal)
{
*pVal = m_Offset;
return S_OK;
}

STDMETHODIMP CYslider::put_Offset(short newVal)
{
m_Offset = newVal;
SetDirty(TRUE);
FireViewChange();
return S_OK;
}


So far so good :), but now I dont know how to deal with arrays,
I googled a lot and I have found that solution is with VARIANT and safearray
but I dont know how to fill STDMETHODIMP for array.

My IDL:

[propget, id(FW_DISPID_ARRAYTEST), helpstring("property ArrayTest")] HRESULT ArrayTest([out, retval] VARIANT *pVal);
[propput, id(FW_DISPID_ARRAYTEST), helpstring("property ArrayTest")] HRESULT ArrayTest([in] VARIANT newVal);

My Cpp:

STDMETHODIMP CYslider::get_ArrayTest(VARIANT *pVal)
{
????????????????????????????????
return S_OK;
}

STDMETHODIMP CYslider::put_ArrayTest(VARIANT newVal)
{
????????????????????????????????
return S_OK;
}

I will be very happy if somebody could help me, with example, advice...

Bye,
Komofilms

This article has been dead for over six months. Start a new discussion instead.