• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

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.
0
c095276
Asked:
c095276
  • 2
1 Solution
 
ShaunWildeCommented:
what have you tried - I would do it like this

_variant_t varType(NODE_ELEMENT); // 1

myObj->createNode(varType,...);
0
 
c095276Author Commented:
Thanks I actually had to cast the NODE_ELEMENT to a BYTE, but it seem to work great.
0
 
ShaunWildeCommented:
you could also do

myObj->createNode("element",...); // NODE_ELEMENT
0
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.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now