Bho browser accessory

xiaoxiao2021-03-13  178

BHO principle: Bho is Browser Helper Object (Browser Auxiliary Object)

BHO correlation principle (Bho associated is SHDOCVW, which means not only related IE, below all IE)

1. Desire's window opens, first look for the CLSID in the Software / Microsoft / Windows / CurrentVersion / Explorer / Browser Helper Objects / CurrentVersion / Explorer / Browser Helper Objects / CLSID, which corresponds to the corresponding BHO plugin, then under this CLSID to HKCR. This plugin is found in CLSIDS, including file locations, and more.

2. I creates a BHO object based on the found CLSID information and looks for the IObjectWithsite interface. (This interface is very simple, only setsite and getsite two methods)

3.ie The IWebBrowser2 (browser plugin) is transmitted to the setSite method of BHO, and the user can mount your own event processing method in this method.

4. When the window is turned off, IE transmits NULL to the SetSite method of BHO, which is used to remove the mounted event processing method.

Write the BHO process 1. Create an IObjectWithSite explicit interface, create a COM type, and implement inheritance IObjectWithsite interface

2. Implement this interface and add the event you want to mount in the Setsite method.

3, handling events

4, register this BHO to the Software // Microsoft // Windows // CurrentVersion // Explorer // Browser Helper Objects under HKLM; (CLSIDS under HKCR is automatically registered according to the path)

5, .NET must be set to set the configuration properties of this BHO project _> to register for Interop as True, so that the .NET class library file can be registered to COM

The sample source code is as follows

http://www.cnblogs.com/files/joybing/urlfilter.zip

转载请注明原文地址:https://www.9cbs.com/read-129087.html

New Post(0)