Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

#import msxml3.dll + msxml.idl

Posted on 2002-03-15
5
Medium Priority
?
953 Views
Last Modified: 2013-11-20
I would like to import msxml3.dll using a #import because that way I get the smart pointers.

This requires the use of the MSXML2 namespace. I cannot leave out the namespace with
using namespace MSXML2 because the symbols conflict and become ambiguous.

I also wish to use IXMLDOMDocument pointers in my idl file, but idl does not recognise namespaces.

There is a conflict here that I cannot resolve.
If you know how to use the #import and reference the imported symbols in an idl please let me know.
This is a common problem to which there seems to be no solution?

Regards
-craig.
0
Comment
Question by:cmain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 6869612
In the IDL file, can't you just use a generic IDispatch pointer?  Just make sure the clients are aware that it is an MSXML3::IXMLDOMDocument .  I think that is stndard operating procedure.

-- Dan

P.S.  That namespace stuff caused me endless grief when I first started using IXMLDOMDocument.
0
 
LVL 1

Author Comment

by:cmain
ID: 6876408
Yes, I could do that.
It works reasonably well using IUnknown pointers. The problem is that my customers want strongly typed interfaces; and I cannot, in all good consience, disagree with them!

Regards
-craig.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6878207
Worth a try:  Post a 0-pt question with a title like:
   IDL and namespace
and in the question put a link to this Q:

   http://www.experts-exchange.com/mfc/Q.20277317.html

Post it in the XML TA and C++ TA.  Some of those experts distain MFC...

Here is a link to a google thread

http://groups.google.com/groups?hl=en&ie=ISO-8859-1&oe=ISO-8859-1&threadm=eXSw7n90AHA.1576%40tkmsftngp03&rnum=7&prev=/groups%3Fq%3DIDL%2Band%2Bnamespace%2Band%2Bxml%26btnG%3DGoogle%2BSearch%26hl%3Den%26ie%3DISO-8859-1%26oe%3DISO-8859-1

In the final post, the guy seems to know what he is talking about.

Perusing some related thereads, it seesm that there is some agreement that problem is that Microsoft seriously goofed in how they set up MSXML.  We wouldn't need to use namespaces at all if they had planned ahead.

At least one person thinks that it is simply impossible to pass an IXMLDomDocument accross a COM interface.

In the final post in this thread, the user says that s similar post was fixed by installiung the latesd Platform SDK.

http://groups.google.com/groups?hl=en&ie=ISO-8859-1&oe=ISO-8859-1&threadm=250901c07cd0%243e6879d0%2434862ecf%40cpmsftngxa05&rnum=46&prev=/groups%3Fq%3DIDL%2Band%2Bnamespace%2Band%2Bxml%26hl%3Den%26ie%3DISO-8859-1%26oe%3DISO-8859-1%26start%3D40%26sa%3DN

Good luck.

-- Dan


0
 
LVL 1

Author Comment

by:cmain
ID: 6879129
Hi Dan,

I think that the one person who thinks it cannot be done is correct. They have seriously screwed up on the namespaces. The midl compiler should be able to ascertain that IXMLDOMDocument is isomorphic to MSXML2::IXMLDOMDocument and it cannot.

I have searched quite a bit. The only way to actually get it vaguely correct is to use 'using namespace MSXML2' in stdafx.h. The problem with this is that you need to spend hours hacking out the standard headers because they include the older xml declarations.

M$ don't do a whole lot correctly when it comes to c++.

Regards
-craig.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 1200 total points
ID: 6879226
Yes, I agree that the problem is that the standard header files assume/require the old definitions.  And for no apparent reason, the XMLDOM headers seem to be brought in  for completely unrelated classes.

>>M$ don't do a whole lot correctly when it comes to c++.

I have to disagree with that.  The next best programming IDE is a distant second place in terms of getting actual programming done.  Microsoft VC++ is often a target just because there are 10 programmers who use it for every one person who uses something else.  Now 10 people are likely to find (and yell about) a bug a lot sooner (and louder) than one person :)  

-- Dan
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question