BHO principle:
BHO is the Browser Helper Object)
BHO Association Principle(BHO is associated with SHDOCVW, that is to say, it is not only associated with IE. We will describe it with IE below)
1. when the IE window is opened, find the CLSID in SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Browser Helper Objects \ under HKLM. These CLSID correspond to the corresponding BHO plug-in, then, locate the plug-in information, including the file location, in the CLSIDs under HKCR Based on the CLSID.
2. IE creates a BHO object based on the CLSID information and finds the IObjectWithSite interface. (This interface is very simple. Only the SetSite and GetSite methods are available.) 3. IE uploads IWebBrowser2 (browser plug-in) to the SetSite method of BHO. You can mount your own event processing method in this method. 4. When the window is closed, IE transfers null to the SetSite method of BHO. This method is used to remove the mounting event processing method.
Compiling BHO Process
1. Create an IObjectWithSite explicit interface, create a COM type, and inherit the IObjectWithSite Interface
2. implement this interface and add the event to be mounted in the SetSite Method
3. Handling events
4. Register this BHO to Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Browser Helper Objects under HKLM in the registry; (CLSIDs under HKCR is automatically registered based on the above path)
5. Under. net, you must set the Configuration Attribute of this BHO project to "True" for Interop in generation to register the. net class library file to COM.
The source code is as follows:
Http://files.cnblogs.com/joybing/UrlFilter.zip
(Note: IE is only a program based on the WebBroswer plug-in. For programming, WebBroswer can be used directly. Specifically, Microsoft Internet Controls (SHDocVw) is referenced ))