Newbie needs help with _variant_t 
Author Message
 Newbie needs help with _variant_t

Hi,

I need help to convert the following codes to use _variant_t
VARIANT vMissing;
VARIANT vNode;
VariantInit(&vMissing);
VariantInit(&vNode);
V_VT(&vMissing) = VT_ERROR;
V_ERROR(&vMissing) = DISP_E_PARAMNOTFOUND;
V_VT(&vNode) = VT_DISPATCH;
V_DISPATCH(&vNode) = m_ssTree1.GetNodes().GetItem(vCount).GetRoot();

I tried the following , does not look good:
_variant_t vMissing;
_variant_t vNode;
vMissing = DISP_E_PARAMNOTFOUND;
vNode = m_ssTree1.GetNodes().GetItem(vCount).GetRoot();

Thanks in Advance



Sat, 10 Sep 2005 11:17:38 GMT  
 Newbie needs help with _variant_t
vNode should work as written. As to vMissing, just use vtMissing as
defined in <comutil.h>, you don't need to compose your own. If you
insist on doing it yourself, you can do it this way:

_variant_t vMissing(DISP_E_PARAMNOTFOUND, VT_ERROR);

You see, DISP_E_PARAMNOTFOUND is just a #define for an integer literal,
there is no way to know that it's an error code and not just some
number. Without VT_ERROR hint, _variant_t constructor treats it as
VT_I4.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> I need help to convert the following codes to use _variant_t
> VARIANT vMissing;
> VARIANT vNode;
> VariantInit(&vMissing);
> VariantInit(&vNode);
> V_VT(&vMissing) = VT_ERROR;
> V_ERROR(&vMissing) = DISP_E_PARAMNOTFOUND;
> V_VT(&vNode) = VT_DISPATCH;
> V_DISPATCH(&vNode) = m_ssTree1.GetNodes().GetItem(vCount).GetRoot();

> I tried the following , does not look good:
> _variant_t vMissing;
> _variant_t vNode;
> vMissing = DISP_E_PARAMNOTFOUND;
> vNode = m_ssTree1.GetNodes().GetItem(vCount).GetRoot();



Sun, 11 Sep 2005 00:01:19 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie: _variant_t

2. Help C newbie need help please

3. Help C newbie need help please

4. HELP -- NEWBIE NEEDS HELP

5. Extracting Data from _variant_t....please help!!...

6. Help - Filling _variant_t with CString

7. Newbie - fopen help needed

8. Newbie question: Need help please!

9. NEWBIE in need of help

10. A newbie needs help with file processing

11. ***Newbie Needs Help With Functions Program ***

12. Newbie needs help

 

 
Powered by phpBB® Forum Software