Problem with #import
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Problem with #import

  1. #1
    Join Date
    May 2001
    Posts
    31

    Problem with #import

    Hejsan,

    I have a little problem with importing msxml3.dll.
    It has worked fine in both Windows Me and Windows NT but when I try to compile with a Windows 2000 computer I get lots of errors.

    I do the import like this:
    #import "msxml3.dll" named_guids raw_interfaces_only rename_namespace("xml")


    And the errors looks like this:
    ...\debug\msxml3.tlh(172) : error C2059: syntax error : '__uuidof'
    ...\debug\msxml3.tlh(173) : error C2059: syntax error : '__uuidof'

    and so on.

    The code looks like this:
    _COM_SMARTPTR_TYPEDEF(IXMLDOMImplementation, __uuidof(IXMLDOMImplementation));
    _COM_SMARTPTR_TYPEDEF(IXMLDOMNode, __uuidof(IXMLDOMNode));
    _COM_SMARTPTR_TYPEDEF(IXMLDOMNodeList, __uuidof(IXMLDOMNodeList));
    _COM_SMARTPTR_TYPEDEF(IXMLDOMNamedNodeMap, __uuidof(IXMLDOMNamedNodeMap));

    and so on.

    What could be wrong?


  2. #2
    Join Date
    Jan 2001
    Posts
    175

    Re: Problem with #import

    Were u able to solve this? I too am getting a similar problem.


  3. #3
    Join Date
    May 2001
    Posts
    31

    Re: Problem with #import

    No, I still don't know whats wrong.


  4. #4
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    96

    Re: Problem with #import

    Try adding these two lines to the StdAfx.h file:

    // Add the following line before any #include or #import statements
    #define _WIN32_WINNT 0x500

    // Add the following line after other #include statements...
    #import <msxml3.dll> raw_interfaces_only,named_guids



    Also make sure that msxml3.dll is *not* in the same directory as the application you're attempting to compile. Using the angle brackets < > instead of the quotes ensures that you #import the installed version of msxml3.dll.


    Essam Ahmed
    ___________________________________________________
    Author of JScript .NET Programming - Now Avaialble!
    http://www.designs2solutions.com/jsnetprg

    See how easy it is to:
    o migrate from ASP to ASP .NET
    o create a Web Service
    o consume a Web Service from a Windows Forms app
    o work with ADO .NET
    o work with ADO in an ASP .NET application
    o migrate from ADO to ADO .NET
    o ...and more!



    o Accepting subscriptions for a newsletter on the .NET Framework and JScript .NET - Subscribe Today!

    http://www.designs2solutions.com/jsnetprg


  5. #5
    Join Date
    May 2001
    Posts
    31

    Re: Problem with #import

    Thanks for your answer!

    The errors is now fewer but it still dosen't work.

    The errors looks like this:

    Compiling...
    StdAfx.cpp
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(172) : error C2059: syntax error : '__uuidof'
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(173) : error C2059: syntax error : '__uuidof'
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(174) : error C2059: syntax error : '__uuidof'
    ... a lot more the same...
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(1811) : error C2065: 'vtMissing' : undeclared identifier
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(1811) : error C2440: 'default argument' : cannot convert from 'int' to 'struct tagVARIANT'
    No constructor could take the source type, or constructor overload resolution was ambiguous
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(1812) : error C2440: 'default argument' : cannot convert from 'int' to 'struct tagVARIANT'
    No constructor could take the source type, or constructor overload resolution was ambiguous
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(1813) : error C2440: 'default argument' : cannot convert from 'int' to 'struct tagVARIANT'
    No constructor could take the source type, or constructor overload resolution was ambiguous
    c:\mina tester\senaste servercomklar\debug\msxml3.tlh(1823) : error C2440: 'default argument' : cannot convert from 'int' to 'struct tagVARIANT'
    No constructor could take the source type, or constructor overload resolution was ambiguous
    Error executing cl.exe.
    Creating browse info file...
    BSCMAKE: error BK1506 : cannot open file '.\Debug\Blowfish.sbr': No such file or directory
    Error executing bscmake.exe.

    Tprog.exe - 64 error(s), 0 warning(s)



  6. #6
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    96

    Re: Problem with #import

    Very strange. Did you clen all files using the Build\Clean menu option?

    If that does not work, exit Visual Studio, delete the NCB file, and try again (also clean the files again just to be sure).

    If those two options don't work, create a new project and add your existing files to it and try it again.

    If you're still having problems, make sure that msxml3.dll is properly installed. There's a trick to get it to work properly that's documented at msdn.microsoft.com. You need to download a tool called xmlinst.exe that changes the installation of msxml3.dll.



    Essam Ahmed
    ___________________________________________________
    Author of JScript .NET Programming - Now Avaialble!
    http://www.designs2solutions.com/jsnetprg

    See how easy it is to:
    o migrate from ASP to ASP .NET
    o create a Web Service
    o consume a Web Service from a Windows Forms app
    o work with ADO .NET
    o work with ADO in an ASP .NET application
    o migrate from ADO to ADO .NET
    o ...and more!



    o Accepting subscriptions for a newsletter on the .NET Framework and JScript .NET - Subscribe Today!

    http://www.designs2solutions.com/jsnetprg


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center