Consider this function: BOOL GetSingleNodeV(const MSXML2::IXMLDOMDocumentPtr pXMLDoc, const CString &strPath, CString &StrValue) { BOOL bRetCode=FALSE; BSTR bstrQstr = strPath.AllocSysString(); IXMLDOMNodePtr o; o = pXMLDoc->selectSingleNode( bstrQstr); if (o!=NULL) { HRESULT hr=o->get_text(&bstrQstr); if (hr==S_OK) { StrValue = bstrQstr; bRetCode = TRUE; } else { StrValue=""; } } //o->Release(); SysFreeString(bstrQstr); return bRetCode; } Call to selectSingleNode sometimes works as expected but sometimes it throws an exception. How can I extract additional information about this exception?
"JoeSchmoe112" wrote in message news:41619253-B8E2-4EE4-9D7C-C1F03086B966@microsoft.com... > Consider this function: > > BOOL GetSingleNodeV(const MSXML2::IXMLDOMDocumentPtr pXMLDoc, const > CString > &strPath, CString &StrValue) > { > BOOL bRetCode=FALSE; > > BSTR bstrQstr = strPath.AllocSysString(); > IXMLDOMNodePtr o; > o = pXMLDoc->selectSingleNode( bstrQstr); > if (o!=NULL) > { > HRESULT hr=o->get_text(&bstrQstr); > if (hr==S_OK) > { > StrValue = bstrQstr; > bRetCode = TRUE; > } > else > { > StrValue=""; > } > } > //o->Release(); > SysFreeString(bstrQstr); > > return bRetCode; > } > > Call to selectSingleNode sometimes works as expected but sometimes it > throws > an exception. How can I extract additional information about this > exception? You can access details about errors generated by COM components with the _com_error exception:- try { // your code } catch (_com_error &e) { // here you can use _com_error members such as e.Description() } -- Anthony Jones - MVP ASP/ASP.NET