Click here to Skip to main content
6,630,586 members and growing! (17,102 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » General     Advanced License: The Code Project Open License (CPOL)

WebBrowserControl for the .NET Framework 1.1

By Paulo Morgado

An implementation of a web browser control for the .NET Framework 1.1
C#, Windows, .NET, Visual Studio, Dev
Posted:14 Oct 2006
Updated:10 Dec 2007
Views:35,277
Bookmarked:14 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
11 votes for this article.
Popularity: 3.18 Rating: 3.06 out of 5
4 votes, 36.4%
1

2
1 vote, 9.1%
3
1 vote, 9.1%
4
5 votes, 45.5%
5

Introduction

This article presents an implementation of a web browser control for the .NET Framework 1.1. It's more of a reference for what it does than how it's done.

This is not the result of my work but a collection of all the help I got along the way.

Background

The need for this control came from a project I'm working in. It's a smart client Windows application that host application in web browsers and interacts with the pages.

What does it do?

This control is, mainly, an interop to the following COM interfaces:

Interface Description Usage
IWebBrowser2 This interface enables applications to implement an instance of the WebBrowser control (Microsoft ActiveX control) or control an instance of the InternetExplorer application (OLE Automation). Note that not all of the methods listed below are supported by the WebBrowser control. Main web browser operation.
DWebBrowserEvents2 This interface designates an event sink interface that an application must implement in order to receive event notifications from a WebBrowser control or from the Microsoft Internet Explorer application. Note that not all of the events listed below are supported by the WebBrowser control. Handling web browser events.
IDocHostUIHandler This custom interface enables an application hosting the WebBrowser Control or automating Microsoft Internet Explorer to replace the menus, toolbars, and context menus used by MSHTML. Showing the context menu, translating keys and URLs.
IDocHostShowUI A host can supply mechanisms that will show message boxes and Help by implementing the IDocHostShowUI interface. Showing message boxes (alert and confirm) and help.
IOleCommandTarget The IOleCommandTarget interface enables objects and their containers to dispatch commands to each other. For example, an object's toolbars may contain buttons for commands such as Print, Print Preview, Save, New, and Zoom. Handling script errors.

Using the code

The MSHTML primary interop assembly (instaled with the .NET Framework SDK Version 1.1 - usually %ProgramFiles%\Microsoft.NET\Primary Interop Assemblies) is needed to interop with HTML stuff.

Other than that, just add the control to your form or user control.

Update - July 8th, 2007

A few bugs fixed and a change to the API.

Known Issues

When bound to a PropertyGrid, the PropertyGrid throws an Exception. Which means that we still don't have designer support.

Thanks To

Barry M., Igor Tandetnik, Jo�o Melo, Lu�s Abreu, Oleg Mihailik and many more.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Paulo Morgado


Member

Paulo has a bachelor degree in Electronics and Telecommunications (Digital Systems) by the Instituto Superior de Engenharia de Lisboa and a degree of licentiate in Informatics by the Faculdade de Ciências da Universidade Nova de Lisboa and na MCSD for Microsoft .NET certification.


Paulo has also a MCSD for the .NET Framework certification.


Paulo works at Espírito Santo Informática, ACE as a developer/software architect.


Paulo contributes in the Microsoft Portuguese newsgroups and the PontoNetPT community answering questions about software development posted in the (with special focus on the .NET framework).


His growing interest in software architecture drives his participation in the Portuguese Group of Software Architecture – GASP.


His contributions to the community has earned him Microsoft's Most Valuable Professional award.


Blog: http://www.PauloMorgado.NET/


Occupation: Software Developer (Senior)
Company: Paulo Morgado
Location: Portugal Portugal

Other popular Miscellaneous articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 22 of 22 (Total in Forum: 22) (Refresh)FirstPrevNext
Generalusing DocumentCompleted Pinmemberdakkeh3:58 20 Jan '08  
GeneralRe: using DocumentCompleted PinmemberPaulo Morgado10:12 20 Jan '08  
QuestionSessions get lost Pinmemberrootdial9:38 16 Aug '07  
AnswerRe: Sessions get lost PinmemberPaulo Morgado13:00 16 Aug '07  
GeneralLinks crashing in www.yahoo.com [modified] PinmemberBarry M.9:09 1 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberPaulo Morgado15:40 2 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberBarry M.18:41 2 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberPaulo Morgado2:35 3 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberBarry M.5:59 3 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberPaulo Morgado6:52 3 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberBarry M.14:39 3 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberPaulo Morgado14:49 3 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberBarry M.15:01 3 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberPaulo Morgado13:39 25 Jun '07  
GeneralRe: Links crashing in www.yahoo.com PinmemberBarry M.16:24 25 Jun '07  
GeneralTotal suppressing/management of dialog boxes originated by WebBrowser (or any control) [modified] PinmemberSergey Stoyan9:59 15 Dec '06  
GeneralIDocHostShowUI implementation PinmemberSergey Stoyan15:50 11 Dec '06  
GeneralRe: IDocHostShowUI implementation PinmemberPaulo Morgado5:16 12 Dec '06  
GeneralRe: IDocHostShowUI implementation PinmemberSergey Stoyan5:57 12 Dec '06  
GeneralRe: IDocHostShowUI implementation PinmemberPaulo Morgado12:52 12 Dec '06  
GeneralRe: IDocHostShowUI implementation PinmemberSergey Stoyan6:58 14 Dec '06  
GeneralRe: IDocHostShowUI implementation PinmemberPaulo Morgado14:01 14 Dec '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 10 Dec 2007
Editor:
Copyright 2006 by Paulo Morgado
Everything else Copyright © CodeProject, 1999-2009
Web21 | Advertise on the Code Project