<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[XML File laden&#x2F;schließen -&amp;gt; Unhandled exception]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich mein Programm nach Ausführen der folgenden Funktion schließe, tritt eine Unhandled exception auf.</p>
<pre><code class="language-cpp">//header file protected area: 
MSXML2::IXMLDOMDocument2Ptr m_pXMLDoc; 
MSXML2::IXMLDOMElementPtr m_pDocRoot;
</code></pre>
<pre><code class="language-cpp">//cpp file

// Create the XML Document	

	HRESULT hr = m_pXMLDoc.CreateInstance(CLSID_DOMDocument);
	if (FAILED(hr))
	{
		_com_error er(hr);
		AfxMessageBox(er.ErrorMessage());
		return FALSE; 
	}

	// convert xml file name string to something COM can handle (BSTR)
	_bstr_t bstrFileName;
	bstrFileName = strFileName.AllocSysString();
	XmlFileName = strFileName; 

	// call the IXMLDOMDocumentPtr's load function to load the XML document
	variant_t vResult;
	vResult = m_pXMLDoc-&gt;load(bstrFileName);
	if (((bool)vResult) == TRUE) // success!
	{// now that the document is loaded, we need to initialize the root pointer		
		m_pDocRoot = m_pXMLDoc-&gt;documentElement;
	}
	else
	{
		AfxMessageBox(_T(&quot;XML File FAILED to load!&quot;));
		return FALSE;
	}

         //xml file releasen 
	m_pXMLDoc-&gt;Release();
</code></pre>
<p>Unhandeld exception in comip.h</p>
<pre><code class="language-cpp">void _Release() throw()
    {
        if (m_pInterface != NULL) 
        {
            /* !!!! exception bei release() !!!!! */
            m_pInterface-&gt;Release();
        }
    }
</code></pre>
<p>Diese Exception tritt dann auf, wenn ich das Fenster über das Kreuzchen rechts oben versuche zu schließen.</p>
<p>Gruß<br />
Harald</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/274711/xml-file-laden-schließen-gt-unhandled-exception</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 08:45:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/274711.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Oct 2010 09:42:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to XML File laden&#x2F;schließen -&amp;gt; Unhandled exception on Fri, 01 Oct 2010 09:42:15 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>wenn ich mein Programm nach Ausführen der folgenden Funktion schließe, tritt eine Unhandled exception auf.</p>
<pre><code class="language-cpp">//header file protected area: 
MSXML2::IXMLDOMDocument2Ptr m_pXMLDoc; 
MSXML2::IXMLDOMElementPtr m_pDocRoot;
</code></pre>
<pre><code class="language-cpp">//cpp file

// Create the XML Document	

	HRESULT hr = m_pXMLDoc.CreateInstance(CLSID_DOMDocument);
	if (FAILED(hr))
	{
		_com_error er(hr);
		AfxMessageBox(er.ErrorMessage());
		return FALSE; 
	}

	// convert xml file name string to something COM can handle (BSTR)
	_bstr_t bstrFileName;
	bstrFileName = strFileName.AllocSysString();
	XmlFileName = strFileName; 

	// call the IXMLDOMDocumentPtr's load function to load the XML document
	variant_t vResult;
	vResult = m_pXMLDoc-&gt;load(bstrFileName);
	if (((bool)vResult) == TRUE) // success!
	{// now that the document is loaded, we need to initialize the root pointer		
		m_pDocRoot = m_pXMLDoc-&gt;documentElement;
	}
	else
	{
		AfxMessageBox(_T(&quot;XML File FAILED to load!&quot;));
		return FALSE;
	}

         //xml file releasen 
	m_pXMLDoc-&gt;Release();
</code></pre>
<p>Unhandeld exception in comip.h</p>
<pre><code class="language-cpp">void _Release() throw()
    {
        if (m_pInterface != NULL) 
        {
            /* !!!! exception bei release() !!!!! */
            m_pInterface-&gt;Release();
        }
    }
</code></pre>
<p>Diese Exception tritt dann auf, wenn ich das Fenster über das Kreuzchen rechts oben versuche zu schließen.</p>
<p>Gruß<br />
Harald</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1959974</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1959974</guid><dc:creator><![CDATA[Harald T.]]></dc:creator><pubDate>Fri, 01 Oct 2010 09:42:15 GMT</pubDate></item><item><title><![CDATA[Reply to XML File laden&#x2F;schließen -&amp;gt; Unhandled exception on Fri, 01 Oct 2010 09:48:58 GMT]]></title><description><![CDATA[<p>bin bei meiner Recherche etwas weiter gekommen. Wenn ich die beiden</p>
<pre><code class="language-cpp">MSXML2::IXMLDOMDocument2Ptr m_pXMLDoc; 
MSXML2::IXMLDOMElementPtr m_pDocRoot;
</code></pre>
<p>in der cpp-Methode installiere, bekomme ich keine Fehlermeldung.</p>
<p>Daher hier mal einen kurzen Ausschnitt der Klassendefinition:</p>
<pre><code class="language-cpp">class CXmlFile : 
	public CProperty
{
public:
	CXmlFile(void);
	~CXmlFile(void);

public:
	virtual BOOL SetData(CStringList &amp;slist); 
	virtual CString GetValue(const CString &amp; name, const UINT &amp; number); 
	virtual CString GetAttribute(const CString &amp; key, const UINT &amp; number, const CString &amp; attribute); 

protected:

	MSXML2::IXMLDOMDocument2Ptr m_pXMLDoc; 
	MSXML2::IXMLDOMElementPtr m_pDocRoot;
};
</code></pre>
<p>und die CProperty Class</p>
<pre><code class="language-cpp">class CProperty
{
public:
	CProperty(); 
	~CProperty();

public:	
	virtual CString GetValue(const CString &amp; name, const UINT &amp; number); 
	virtual CString GetAttribute(const CString &amp; key, const UINT &amp; number, const CString &amp; attribute); 
	virtual BOOL SetData(CStringList &amp;slist); 
};
</code></pre>
<p>Alle virtuellen Methoden dieser Klasse sind auch in der XML-File Klasse vorhanden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1959980</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1959980</guid><dc:creator><![CDATA[Harald T.]]></dc:creator><pubDate>Fri, 01 Oct 2010 09:48:58 GMT</pubDate></item><item><title><![CDATA[Reply to XML File laden&#x2F;schließen -&amp;gt; Unhandled exception on Fri, 01 Oct 2010 12:43:32 GMT]]></title><description><![CDATA[<p>Was bedeutet denn <em>in der cpp-Methode installiere</em>? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f576.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--sunglasses"
      title=":sunglasses:"
      alt="🕶"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1960070</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1960070</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Fri, 01 Oct 2010 12:43:32 GMT</pubDate></item></channel></rss>