The web| control is looking for a way to customize the WebBrowser control these days because of the work required. has been studied for a while, the principle is probably known,
The basic is to implement the IDocHostUIHandler and Idochostshowui two interfaces, IE control will call these two interfaces at the appropriate time,
I just need to follow the instructions in the Help document to set a different value.
There are two ways to hook up these two interface interfaces into a control:
One is through the Icustomdoc interface customization, the code is as follows:
Html0. Navigate2 ("About:blank");
Icustomdoc o = html0. Document as Icustomdoc;
O.setuihandler (this as IDocHostUIHandler);
However, since only documents can be loaded before the value of document is available, it is necessary to mount an empty document beforehand, here is about:blank.
The second approach is to complete all the interfaces required by the Active Document Host
, IOleClientSite
, IOleInPlaceSite
, IOleDocumentSite
, Iolewindow//IOleInPlaceSite already contains the interface
, IDocHostUIHandler
, Idochostshowui
The Ioleinplacesite.getwindowcontext call requires the following two interfaces
, IOleInPlaceFrame
, IOleInPlaceUIWindow//IOleInPlaceFrame has implemented the interface
Interface Ioleclientsite.getcontainor need to use
, IOleContainer
The code to hook up these interfaces to the control is as follows:
IOleObject o = html0. GETOCX () as IOleObject;
O.setclientsite (this as IOleClientSite);
Once the hook is successful, the following functions are typically called
IOleInPlaceSite GetWindow
IDocHostUIHandler GetHostInfo
IDocHostUIHandler GetOptionKeyPath
IDocHostUIHandler GetHostInfo
IDocHostUIHandler GetDropTarget
IDocHostUIHandler UpdateUI
IDocHostUIHandler ShowUI
IDocHostUIHandler HideUI
IDocHostUIHandler TranslateAccelerator
IDocHostUIHandler TranslateUrl
IDocHostUIHandler ShowContextMenu
Idochostshowui Idochostshowui
IOleClientSite GetContainer
Another method is to embed HTMLDocument objects directly using the document embedding function, which eliminates the use of WebBrowser controls. HtmlEditor is the way to use it, but I didn't make it.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.