<?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[IWebBrowser2 - Quelltext anzeigen]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann ich den HTML-Quelltext einer Seite von einem IWebBrowser2 Control anzeigen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/102183/iwebbrowser2-quelltext-anzeigen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 10:55:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/102183.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Feb 2005 13:07:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to IWebBrowser2 - Quelltext anzeigen on Wed, 23 Feb 2005 13:07:08 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann ich den HTML-Quelltext einer Seite von einem IWebBrowser2 Control anzeigen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/730507</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/730507</guid><dc:creator><![CDATA[Ryson]]></dc:creator><pubDate>Wed, 23 Feb 2005 13:07:08 GMT</pubDate></item><item><title><![CDATA[Reply to IWebBrowser2 - Quelltext anzeigen on Wed, 23 Feb 2005 21:53:46 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/8348">@Ryson</a>, soweit ich weiß musst du dir von deinem Browser-Objekt das dazugehörige IHTMLDocument2 geben lassen. Von dort aus solltest du auf den Quelltext der jeweiligen Seite zugreifen können. Habe nur gerade keinen Beispielcode zur Hand.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/731087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/731087</guid><dc:creator><![CDATA[Herrmann]]></dc:creator><pubDate>Wed, 23 Feb 2005 21:53:46 GMT</pubDate></item><item><title><![CDATA[Reply to IWebBrowser2 - Quelltext anzeigen on Fri, 25 Feb 2005 00:14:15 GMT]]></title><description><![CDATA[<p>Danke Herrmann, das hat mich schon ein ganzes Stück weiter gebracht.<br />
Den Quelltext kann ich nun abfragen, allerdings nur den body-Teil.<br />
Wie erhalte ich den kompletten Code?</p>
<pre><code>HRESULT		hr;
	IDispatch		*htmlDisp	= NULL;
	IHTMLDocument2	*doc		= NULL;
	IHTMLElement	*element	= NULL;

	hr = pIwb-&gt;get_Document(&amp;htmlDisp);

	if( FAILED(hr) &amp;&amp; htmlDisp == NULL )
	{
		return E_FAIL;		
	}

	hr = htmlDisp-&gt;QueryInterface(IID_IHTMLDocument2, (void**)&amp;doc);

	if( FAILED(hr) &amp;&amp; doc == NULL )
	{
		htmlDisp-&gt;Release();
		return E_FAIL;	
	}

	hr = doc-&gt;get_body(&amp;element);

	if( FAILED(hr) &amp;&amp; element == NULL )
	{    
		htmlDisp-&gt;Release();
		doc-&gt;Release();
		return E_FAIL;	
	}

	hr = element-&gt;get_outerHTML(html);

	htmlDisp-&gt;Release();
	doc-&gt;Release();
	element-&gt;Release();

	if( FAILED(hr) )
	{    
		return E_FAIL;	
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/731876</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/731876</guid><dc:creator><![CDATA[Ryson]]></dc:creator><pubDate>Fri, 25 Feb 2005 00:14:15 GMT</pubDate></item><item><title><![CDATA[Reply to IWebBrowser2 - Quelltext anzeigen on Sun, 27 Feb 2005 08:40:05 GMT]]></title><description><![CDATA[<p>Guck Dir mal die anderen IHtmlDocument-Interfaces an. Jedes Interface hat bestimmte Funktionen, die im anderen nicht vorkommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/733261</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/733261</guid><dc:creator><![CDATA[Power Off]]></dc:creator><pubDate>Sun, 27 Feb 2005 08:40:05 GMT</pubDate></item><item><title><![CDATA[Reply to IWebBrowser2 - Quelltext anzeigen on Mon, 28 Feb 2005 21:08:05 GMT]]></title><description><![CDATA[<p>Ja. Danke. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Es ist umständlich.<br />
Hier die gekürzte Fassung...</p>
<pre><code>(BSTR* source, BOOL bPlainText)

	IWebBrowser2 *pIwb	 = NULL;

	HRESULT hr;

	IDispatch	 *pHTMLDisp = NULL;
	IHTMLDocument2 *pHTMLDoc = NULL;
	IHTMLElementCollection *pHTMLCollection = NULL;

	IDispatch	 *pTAGDispatch = NULL; 
	IHTMLElementCollection *pTAGCollection = NULL;

	IDispatch *pItemDispatch = NULL; 
	IHTMLElement *pItemHTML = NULL; 

	hr = pIwb-&gt;get_Document(&amp;pHTMLDisp);

	...
	hr = pHTMLDisp-&gt;QueryInterface(IID_IHTMLDocument2, (void**)&amp;pHTMLDoc);

	...
	hr = pHTMLDoc-&gt;get_all(&amp;pHTMLCollection);

	...
	hr = pHTMLCollection-&gt;tags(CComVariant( &quot;HTML&quot; ), &amp;pTAGDispatch);

	...
	hr = pTAGDispatch-&gt;QueryInterface(IID_IHTMLElementCollection, (void**)&amp;pTAGCollection);

	...
	hr = pTAGCollection-&gt;item(CComVariant( 0L ), CComVariant(), &amp;pItemDispatch);

	...	
	hr = pItemDispatch-&gt;QueryInterface(IID_IHTMLElement, (void**)&amp;pItemHTML);

	...
	if( bPlainText )
	{
		pItemHTML-&gt;get_outerText(source);
	}
	else
	{
		pItemHTML-&gt;get_outerHTML(source);
	}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/734776</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/734776</guid><dc:creator><![CDATA[Ryson]]></dc:creator><pubDate>Mon, 28 Feb 2005 21:08:05 GMT</pubDate></item></channel></rss>