Vikram Ranabhatt
Vikram Ranabhatt

Reputation: 7630

Windows Browser Control Vs CDHtmlDialog and CHtmlView

I wanted to know the difference among following control and classes.

Windows Browser Control Vs CDHtmlDialog and CHtmlView.

It is visible that these things are used to add html content in UI for windows based application.

But when we search in internet one will often confused with these things.

It would be good if some explain the usability of these Control and Classes.

Upvotes: 3

Views: 3328

Answers (1)

peterchen
peterchen

Reputation: 41116

The Web Browser Control is a Windows ActiveX control that is probably used by Internet Explorer itself to display HTML contents. At the very least, Web Browser Control and Internet Explorer use the same implementation for rendering HTML.

CHtmlView is a MFC - CView -derived class hosting said ActiveX control.
CHtmlDialog is a MFC - CDialog - derived class doing the same.

They are separate classes because unfortunately MFC has a "huge gap" between dialogs, views and windows.

I haven't worked significantly with either MFC class but in my understanding they don't add any functionality by themselves. You can as well host the web browser control like a normal ActiveX and use GetControlUnknown to acquire IWebBrowser interface.


The biggest problem in my experience is that DOM is only accessible after DocumentComplete, and that event won't fire before the message loop doesn't pump. This makes some operations rather painful I ended up with a custom interface queuing modifications until DOM is available.


P.S. Windows now offers the WebView2 - ActiveX control, based on Edge, as a sufficient and powerful replacement. see https://learn.microsoft.com/en-us/microsoft-edge/webview2/

Upvotes: 3

Related Questions