-1

I am loading and reading a xml file. I was successful when I was using Visual studio 6 but now I have changed to Visual studio 10 and does not compile.

I am developing SDI application using MFC classes.

This are the errors:

  1. error 1120 - , one unresolved externals
  2. unhandled exception

Code:

CComPtr<IXMLDOMElement> iRootElm;
    ::CoInitialize(NULL);
    HRESULT hr = m_plDomDocument.CreateInstance(__uuidof(DOMDocument));
    if (FAILED(hr))
    {
        _com_error er(hr);
        AfxMessageBox(er.ErrorMessage());
        //EndDialog(1);
    }



    CString strFileName ("TestCase.xml");

    // convert xml file name string to something COM can handle (BSTR)
    //fname = strFileName;
    _bstr_t bstrFileName;
    VARIANT_BOOL *flag = NULL;

    bstrFileName = fname.AllocSysString();

    _variant_t source;
    source.vt = VT_BSTR;
    source.bstrVal = bstrFileName;
    //VARIANT source = (VARIANT)fname;


    // call the IXMLDOMDocumentPtr's load function to load the XML document

    variant_t vResult;
    //vResult = ;
    vResult = m_plDomDocument->load(source , flag);
    bool v = (bool)vResult;

    if ((bool)vResult == true) // success!
    {
        // now that the document is loaded, we need to initialize the root pointer
        //m_pDocRoot = m_plDomDocument->createElement((_bstr_t)"TestCase" , temp); // ->documentElement;

        m_pDocRoot = m_plDomDocument->get_documentElement(&iRootElm);
        //m_pDocRoot = m_plDomDocument->createElement((_bstr_t)"TestCase.cml" );
        AfxMessageBox(_T("Document loaded successfully!"));
        //AfxMessageBox(m_plDomDocument);
    }

    else
    {
        AfxMessageBox(_T("Document FAILED to load!"));  
    }
}
Raydel Miranda
  • 13,825
  • 3
  • 38
  • 60

1 Answers1

0

According Visual studio Help

Fatal error C1120

This error indicates Visual C++ needs to be reinstalled.

:(

Community
  • 1
  • 1
Raydel Miranda
  • 13,825
  • 3
  • 38
  • 60