title: IHTMLDocument2->documentElement->outerHTML is too slow recreating HTML from DOM, is there a faster way?
body: <p>I've got an IE BHO plugin that sends out via a COM call the HTML of a page that was loaded in the window.</p>
  
  <pre><code>// Note all error handling removed for readability :)
  STDMETHODIMP CPlugin::get_HTML(long lMaxSize, BSTR *pbstrHTML)
  {
      CComPtr&lt;IDispatch&gt; pDispatch;
      MSHTML::IHTMLDocument2Ptr pDocument2 = NULL;
      MSHTML::IHTMLDocument3Ptr pDocument3 = NULL;
      hr = m_spWebBrowser-&gt;get_Document(&amp;pDispatch);
      hr = pDispatch-&gt;QueryInterface(IID_IHTMLDocument3, (void**)&amp;pDocument3);
      MSHTML::IHTMLElementPtr pRoot = pDocument3-&gt;documentElement;
      wstring strHTML = pRoot-&gt;outerHTML;
      CComBSTR bstrHTML = strOutput.c_str();
      bstrHTML.CopyTo(pbstrHTML);
  }
  </code></pre>
  
  <p>However when it encounters a very large page (e.g. "<a href="http://sitemap.zillow.com/uncompressed/ForSale_Hood_MedPri_1.xml" rel="nofollow noreferrer">http://sitemap.zillow.com/uncompressed/ForSale_Hood_MedPri_1.xml</a>"), it takes 3 minutes to create the HTML from the DOM.</p>
  
  <p>Is there a way to access the raw HTML/XML?</p>
  
  <p>When you do a 'view page source' in IE, it pops up almost immediately, so internally IE must be using some API that can do what I want.</p>
  
  <p>Thanks,<br>
  Shane.</p>