03-21-2006 04:56 AM
03-21-2006 08:59 AM
The cvixml library is an ActiveX client of the Microsoft XML ActiveX server and uses the CVI ActiveX library in its implementation. All ActiveX code needs to be initialized using CoInitialize(Ex) - but this is automatically done for the cvixml library. The first call into the CVI ActiveX library will result in CoInitializeEx being called if required. If you have already called CoInitialize or the CVI equivalent CA_InitActiveXThreadStyleForCurrentThread, then this initialization will be skipped.
There are two ways to initialize ActiveX (COM) - MTA and STA. CoInitialize uses STA. CVI ActiveX library uses MTA by default. But some components (not XML) may require STA initialization and I think this is what is happening in your case. If you call cvixml, it initializes with MTA and then some other component in your program does not work. In this case, your solution of calling CoInitialize (or CA_InitActiveXThreadStyleForCurrentThread with STA) yourself is the correct one.