Paul Fallon's WebLog

From Ireland: a little bit of this and a little bit of that

The Web Browser control in Whidbey - Part 2

In the pre-release documentation for Visual Studio 2005, you will find a How to: Add Web Browser Capabilities to Your Windows Forms Application, but I would like to show how easy this stuff has become, so I'll post a few screenshots and give you an overview of the moving parts!

Start up your favorite beta version of Visual Studio 2005 and create a new Windows Application project. Note: the screenshots I use are from Visual Basic 2005 Express Edition Beta and if you want a bigger version of the screenshots, just click on them and they should open in a new browser window.

With your newly created Windows Application project, you get the standard "Form1" ready to be designed.  The Toolbox dockable window should be on the left hand side, and if you scroll down you should see a WebBrowser control. Place a Web Browser control on the Form, its simply a Drag and Drop.

Now, this is where it really gets interesting! Have a look at the properties window when you have the Web Browser control selected. In there you will find some great properties, such as ContextMenuStrip, IsWebBrowserContextMenuEnabled, ScriptErrorsSuppressed, WebBrowserShortcutsEnabled etc... All/most of these properites have been very difficult to implement in VB in the past and it would typically require C++ code for you to be able to control these features of the Web browser control when reusing it.

From here, its easy to see where the possibilities lie!! By adding a Textbox (i.e. a URL address box) and a button (i.e. Go) and a few lines of code to connect them together, you now have a basic browser! So now, you have the possiblity of easily creating your own browser, with its own look and feel :)  Pretty cool stuff!

All of the Beta pre-release documentation for the System.Windows.Forms namespace and the Web Browser control can be found at http://lab.msdn.microsoft.com/

Published Tuesday, October 19, 2004 12:31 PM by no1138
Filed under: ,

Comments

 

Marcus Mac Innes said:

Too bad it has just been delayed again... :|

http://www.theserverside.net/news/thread.tss?thread_id=29537
October 20, 2004 9:25 AM
 

Vaibhav Verma said:

hi, I just wanted to know how i can trap http header request and response header through the WEB browser control
October 29, 2004 7:00 PM
 

Paul said:

Hi Vaibhav,
its been a while since I was customising browser for a living :), but as far as I recall there is nothing in the object model that give you acess to the Request and Response headers. I've had a look in the new OM for the managed wrapper and it looks like there is new no addition that exposes this information either.

One possible way that maybe of help, is the developement of an APP (Async. Pluggable Protocol), now I have not tried using an APP object to get the request/response headers for the default HTTP stream, but their might be a way of getting access to the streams.

Sorry that I don't have any other pointers for you, but as far as I recall this has been a tricky thing to implement. Also, if you try the newsgoups, you might find someone that has a few more pointers for you?

thx,
P.
November 1, 2004 3:56 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker