Passing const _variant_t & to a function in a dll

I have used the #import to import the msxml.dll in one of my projects.  The following function is giving me trouble.
IXMLDOMNodePtr createNode ( const _variant_t & type, _bstr_t name, _bstr_t namespaceURI );

How do you pass the first argument in.  I tryed to pass the nodeType property from another node into it and I get compile errors. I have tryed to cast the argument to a COleVariant object, and that also gives an error.
Who is Participating?
ShaunWildeConnect With a Mentor Commented:
what have you tried - I would do it like this

_variant_t varType(NODE_ELEMENT); // 1

c095276Author Commented:
Thanks I actually had to cast the NODE_ELEMENT to a BYTE, but it seem to work great.
you could also do

myObj->createNode("element",...); // NODE_ELEMENT
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.