Quantcast
Channel: Internet Explorer 8, 9, 10, 11 forum
Viewing all articles
Browse latest Browse all 10469

IHTMLDocument2::get_body fails in CHtmlView for IE 11

$
0
0

We've hit a simple, but critical, problem: IHTMLDocument2::get_body works in our embedded browser (CHtmlView) for IE7, but not IE11. We really want to start using the newer version, but this is a killer right now.

We use Visual Studio 2010. Native (unmanaged) C++. Problem occurs in both 32 and 64 bit builds. I don't know where this started failing (IE8? IE9? IE10?). OnNavigateComplete2 has fired before we try to call this function.

Here's our code, which has worked for us for a long time:

ComPtr<IHTMLTxtRange> CHighlightHTML::GetRange(ComPtr<IHTMLDocument2> document)
{
    ComPtr<IHTMLElement> elt;
    ComPtr<IHTMLBodyElement> body;

    if( SUCCEEDED(document->get_body(&elt.ReleaseGetValue())) )
        body = elt;

    if( body.IsValid() )
    {
        // Create a range from the entire body element.
        ComPtr<IHTMLTxtRange> range;
        CHECK_COM(body, createTextRange(&range.ReleaseGetValue()));
        return range;               
    }
}

But when we set the registry key: HKCU/Software/Microsoft/Internet Explorer/Main/FeatureControl/FEATURE_BROWSER_EMULATION

to 11000 for our .exe, then elt == NULL (so fails the body.IsValid() test)

If we have not set the registry key, or set the key to 7000 (so browser control is IE7), then it works again.

Help!



Viewing all articles
Browse latest Browse all 10469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>