High-Performance Development - C#, VB, SQL, ASP.NET

Slogan Text

How to Code-Build-Debug a BHO

Create BHO Register & Unregister Files

IE looks in the registry to find any plug-ins (BHOs) to load. You must register your BHO so IE can find it.

Create Register.bat:

  1. Open a MS-DOS Command Prompt window.
  2. Start Notepad: Notepad Register.bat

  3. Enter the following on one line in Register.bat:


    "c:\inetpub\wwwroot\BHO\BHO\bin\debug\BHO.dll" /codebase

    You may need to locate regasm.exe and change the path accordingly.

    Change the path to the location of your BHO project.

  4. Start Notepad and create Unregister.bat.


    "c:\inetpub\wwwroot\BHO\BHO\bin\Debug\BHO.dll" /unregister /codebase

    Change the file paths as appropriate for your system.

Code-Build-Debug Cycle

  1. Close all IE intstances and any windows created by IE such as View Source windows.
  2. Open an Windows Command Prompt in Administrator-mode.

    1. Click on Start Icon.
    2. Go to All Programs\Accessories and find Command Prompt.
    3. Go Right-click on Command Prompt.
    4. Click on "Run as Administrator".
  3. Enter Unregister.bat.
    This will unregister any previous version of your BHO.
  4. Enter Register.Bat.
  5. Start IE.

    1. Do not start IE from the bottom menu!
    2. Click on Start icon.
    3. Find & click on Internet Explorer.

Create a Separate Class Library

Debugging an IE Browser Helper Object (BHO) is challenging.

To improve your development process I suggest:

  1. Create a separate class library to hold your main code modules.
  2. Test your classes using an open source tests tools like MbUnit and Gallio.
  3. Code your BHO to reference classes in your class library.

How to Display Debug Messages - Simple

                string Message;
                Message = String.Format("Counter = {0}", Counter);

How to Auto-Click A Button

How to Select Radio Button Options

How to Set a Checkbox

                            InputObj = (HTMLInputElement)Element1Obj;
                            InputObj.value = FieldObj.Value;

                            if (FieldObj.Value == "Y")
                                InputObj.setAttribute("checked", "true");

How to Set Text in Text Boxes

How to Parse or Screen-Scrape Page Information