get/put(VARIANT newVal) ??

Reply

Join Date: Jan 2009
Posts: 1
Reputation: komofilms is an unknown quantity at this point 
Solved Threads: 0
komofilms komofilms is offline Offline
Newbie Poster

get/put(VARIANT newVal) ??

 
0
  #1
Jan 9th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,149
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1435
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: get/put(VARIANT newVal) ??

 
0
  #2
Jan 9th, 2009
If you did your googling then you had to come across this article. It illustrates an array of BSTRs, but the syntax is nearly the same for any POD (plain-old-data) type.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC