Get the MSXML 4.0 parser running -- help!

Hello everybody,

I'm currently writing a wrapper class for the MSXML 4.0 parser in C++, and I have a problem to get the app running on systems where the parser SDK is not installed.

I'm using the #import directive to import the classes from the msxml4.dll library into my code, but that doesn't seem to be enough. When I start the app on another system where the SDK is NOT installed, I'm catching an exception: "Class not registered". I think it's a COM exception, since I use the following smart pointer interfaces:

IXMLDOMDocument2Ptr
IXMLDOMNodePtr

When creating the instance of the document, I pass the class ID CLSID_DOMDocument40 as the argument.

Well, it works just fine, except that the SDK needs to be installed to start the app. That's not bearable to force the user to install a software dev kit in order to use my apps!

As a side note:
If I use the older interface, in fact IXMLDOMDocument, and pass the class ID CLSID_DOMDocument, then it seems to work without installing the SDK. I already tried to #import msxml4a.dll and #import msxml4r.dll as well, but this only generated a compiler error.

Can you help me here?


Comments

  • : Hello everybody,
    :
    : I'm currently writing a wrapper class for the MSXML 4.0 parser in C++, and I have a problem to get the app running on systems where the parser SDK is not installed.
    :
    : I'm using the #import directive to import the classes from the msxml4.dll library into my code, but that doesn't seem to be enough. When I start the app on another system where the SDK is NOT installed, I'm catching an exception: "Class not registered". I think it's a COM exception, since I use the following smart pointer interfaces:
    :
    : IXMLDOMDocument2Ptr
    : IXMLDOMNodePtr
    :
    : When creating the instance of the document, I pass the class ID CLSID_DOMDocument40 as the argument.
    :
    : Well, it works just fine, except that the SDK needs to be installed to start the app. That's not bearable to force the user to install a software dev kit in order to use my apps!
    :
    : As a side note:
    : If I use the older interface, in fact IXMLDOMDocument, and pass the class ID CLSID_DOMDocument, then it seems to work without installing the SDK. I already tried to #import msxml4a.dll and #import msxml4r.dll as well, but this only generated a compiler error.
    :
    : Can you help me here?
    :
    :
    :

    Is "msxml4.dll" pressent on the client machine?
    "Class not registered" is when you try to access an COM/ActiveX library that hasn't been registered. If you ship "msxml4.dll" with your program then you need to register it by typing "regsvr32 " on the commandline. Where should be the full filename (with pathname) of the "msxml4.dll" (or any other dll/ocx files that you use).
  • : Is "msxml4.dll" pressent on the client machine?
    : "Class not registered" is when you try to access an COM/ActiveX library that hasn't been registered. If you ship "msxml4.dll" with your program then you need to register it by typing "regsvr32 " on the commandline. Where should be the full filename (with pathname) of the "msxml4.dll" (or any other dll/ocx files that you use).
    :

    Yes, msxml4.dll is present on the client machine. I also tried to copy all 4x dll's into the system32 directory manually, but this didn't have any effect.

    I'm not sure what you mean with that registering...
    Does this mean everybody who uses my app has to type this in the command line?!
  • : : Is "msxml4.dll" pressent on the client machine?
    : : "Class not registered" is when you try to access an COM/ActiveX library that hasn't been registered. If you ship "msxml4.dll" with your program then you need to register it by typing "regsvr32 " on the commandline. Where should be the full filename (with pathname) of the "msxml4.dll" (or any other dll/ocx files that you use).
    : :
    :
    : Yes, msxml4.dll is present on the client machine. I also tried to copy all 4x dll's into the system32 directory manually, but this didn't have any effect.
    :
    : I'm not sure what you mean with that registering...
    : Does this mean everybody who uses my app has to type this in the command line?!
    :

    Most installers take care of this (I think). If you author your own installation (like writing an MSI database by hand using Orca) you have to desclare it somewhere in the installer yourself.

    Anyway, if you copy a COM-dll or an ActiveX control to a system where the file was not previously present or are installing a newer version of that file then you need to register that file with windows. Every COM and ActiveX library has some information that it needs to add to the Windows Registry in order for that library to work (like CLSID, GUID, that sort of stuff). Those libs export a function called DllRegisterServer() which, when called, adds that info to the registry.
    "regsvr32.exe" is a program that comes with windows which calls this function in the lib and thus registers the COM/ActiveX library.

    So if you use an ActiveX/COM object in your program without properly registering the library which contains that object, you get the "class not registered" error.

    You should try it on one client machine and if it works then you know that this is the problem. If it still doesn't work then I'm affraid I don't know what else could be wrong other than that some dll/ocx you use has some external dependancies (in other words: is missing some other dll/ocx files that are required for it to work)
  • : : : Is "msxml4.dll" pressent on the client machine?
    : : : "Class not registered" is when you try to access an COM/ActiveX library that hasn't been registered. If you ship "msxml4.dll" with your program then you need to register it by typing "regsvr32 " on the commandline. Where should be the full filename (with pathname) of the "msxml4.dll" (or any other dll/ocx files that you use).
    : : :
    : :
    : : Yes, msxml4.dll is present on the client machine. I also tried to copy all 4x dll's into the system32 directory manually, but this didn't have any effect.
    : :
    : : I'm not sure what you mean with that registering...
    : : Does this mean everybody who uses my app has to type this in the command line?!
    : :
    :
    : Most installers take care of this (I think). If you author your own installation (like writing an MSI database by hand using Orca) you have to desclare it somewhere in the installer yourself.
    :
    : Anyway, if you copy a COM-dll or an ActiveX control to a system where the file was not previously present or are installing a newer version of that file then you need to register that file with windows. Every COM and ActiveX library has some information that it needs to add to the Windows Registry in order for that library to work (like CLSID, GUID, that sort of stuff). Those libs export a function called DllRegisterServer() which, when called, adds that info to the registry.
    : "regsvr32.exe" is a program that comes with windows which calls this function in the lib and thus registers the COM/ActiveX library.
    :
    : So if you use an ActiveX/COM object in your program without properly registering the library which contains that object, you get the "class not registered" error.
    :
    : You should try it on one client machine and if it works then you know that this is the problem. If it still doesn't work then I'm affraid I don't know what else could be wrong other than that some dll/ocx you use has some external dependancies (in other words: is missing some other dll/ocx files that are required for it to work)
    :

    Heck, I didn't even think about an installer program yet... That means I have to get into a scripting language for the used installer.

    Well, thanks for the info, that's definitely the solution.

    Oh and, I browsed through the MSDN library on this issue and stumbled across a function called DllInstall, which takes a "regsvr32.exe" command as an argument and a boolean value whether to install or uninstall the dll.

    Call me a moron, but I didn't manage the function to work. It seems that I can't pass a constant string as the argument, so I get an error when saying DllInstall( true, _T("") );

    Have you already worked with this function?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories