المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Exception while using CComPtr



C++ Programming
04-07-2009, 06:16 PM
Hi,
I am using the following code:


CString csXmlFile = "MyXML.xml";
CComPtr fXmlValDocPtr;
HRESULT hr = fXmlValDocPtr.CoCreateInstance( L"Microsoft.XMLDOM" );
VARIANT_BOOL isSuccessful = VARIANT_FALSE;
if( hr == S_OK )
{
fXmlValDocPtr->put_async( VARIANT_FALSE );

BSTR bstrCsXmlFile = csXmlFile.AllocSysString();
_variant_t tempcsXmlFile(bstrCsXmlFile);
hr = fXmlValDocPtr->load(tempcsXmlFile, &isSuccessful);
tempcsXmlFile.Detach();
}

Getting the following exception. Can I know what is the bug in above code.

kernel32!RaiseException+58 e0000001 00000000 00000001
msxml3!Exception::raiseException+5f 800c0006 8fd64972 00000000
msxml3!Document::HandleEndDocument+45 8fd64926 00000000 07ade1a8
msxml3!NodeFactory::abort+34 07ad46a8 00000000 8fd648de
msxml3!NodeFactory::Error+2d 07ad6000 07ad46a8 c00ce551
msxml3!Document::abort+e9 07ad6000 8fd6486a 00000000
msxml3!Document::_load+1b8 07adf000 00000000 00000000
msxml3!Document::load+44 07ade038 00000000 8fd64bf6
msxml3!DOMDocumentWrapper::load+1e4 00000000 00000008 00000030