Q=============================================== I want to provide IDochostShowui interfaces in ChtmlView, But I don't know how to provide this interface. I have checked a lot of information, as if you must implement the IoledocumentSite and IoleClient interface, you have to overload ChtmlView :: CreateControlsite (), I have no way to use the default ControlSite in chtmlview. What should I do to easily implement this interface? 2004-09-27 Answ ======================================== 扩 WebBrowser in VC6 And differ in later versions (VC7.0 / VC7.1). The implementation of CHTMLVIEW in VC6 is very simple, just call CreateControl created a WebBrowser Control without additional advanced control. Extended (such as IdochOStuiHandler) only implements a custom Control site, and requires a CoccManager to manage (there are examples in MSDN in the Knowledge Base in MSDN, and it will also be on my blog). The MFC implementation of VC7.x is different, providing better support for embedding ActiveX Control in the window, such as the CREATECONTETECONTETE method for overloading CWND, enables custom OLE CONTROL SITE. The ChtmlView in VC7.X has provided extensions to IDOchostuiHandler, and below is the CreateControlsite method of ChtmlView, which creates a ChtmlControlSite.
BOOL CHtmlView :: CreateControlSite (COleControlContainer * pContainer, COleControlSite ** ppSite, UINT / * nID * /, REFCLSID / * clsid * /) {ASSERT (ppSite = NULL!); * PpSite = new CHtmlControlSite (pContainer); return TRUE; }
Therefore, to achieve IDocHostShowUI like extensions, or need COleControlSite CHtmlControlSite derived from a custom Control Site (viewhtml.cpp code implementation may refer to the CHtmlControlSite), then according to the above example in their coverage CHtmlView :: CreateControlSite i.e. in HtmlView However, the difference is no longer necessary to manually give CoccManager. Quote Address: FAQ: Extension ChtmlView