BHO Examples

One of the problems I ran into when I started looking at converting PeteSearch from a Firefox plugin to an Internet Explorer extension was finding good example code. There are a couple of great articles on MSDN that cover how to write a BHO, but neither include complete source code. Here’s the list of all the code samples I managed to find, and a couple I wrote myself:

A very simple skeleton BHO that I wrote:

A more complex example based on my Firefox add-on:

From Sven Groot, the source to his FindAsYouType extension:

The SurfHelper pop-up blocker from Xiaolin Zhang:

A simple example covering all the BHO events from René Nyffenegger:

More posts on porting Firefox add-ons to IE

4 responses

  1. Pete,
    Amazing Posts.
    These are by far the most informative and explanatory posts related to creating BHOs I can find online. I cant tell you how much I’m waiting to see how to build a good installer. I’ve followed you so far through this and I’ve got PeteSearch building off Visual C Express, and running in my IE7.
    Thanks again, and please do post your installer code when you get something up and running.
    Also, I haven’t looked into it much yet, but how much space does the Boost runtime add to the msi/exe? I’ve got a BHO written in C# but I want to port it to C++ to save people the 27MB dl for the .NET 1.1 runtime. Is Boost any better on the size front?

  2. Pete,
    One other question? Have you found a solution to the IE reload detection problem? As you probably are finding out, the DocumentComplete event is not fired on Reload/Refresh actions. How are you going about capturing a Reload? I’ve seen many elaborate schemes that include catching downloadbegins, downloadcompletes with counters, semaphores, and threads with a lot of Sleep calls in them, but i haven’t found any that get the job done.

  3. Thanks Stephen, it’s great to hear this is helping!
    When building a ‘minimum dependency’ release build (which should statically link as much as possible into the DLL), PeteSearch is around 280k. It was 20-30k before I added boost I think, so it’s not too bad. I need to verify that I haven’t introduced any other dll dependencies I’ll also need to install, but I’ve tried to avoid that.
    And yes, I’m dreading the DocumentComplete handling on refresh! I don’t have a good handle on that yet, but I get the feeling it will be interesting, to say the least.

Leave a Reply to Stephen Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: