ARTICLE

Creating an instance of Internet Explorer in VB.NET

Posted by Gregory Correll Articles | Visual Basic 2010 August 02, 2003
I was trying to write a program that opened an instance of Internet Explorer in a separate window, rather than use the Browser control that comes with the .NET platform.Unfortunately, it proved almost impossible to find any references to the interfaces necessary to do the job. Here is the souce code that does the same.
Download Files:
 
Reader Level:

I was trying to write a program that opened an instance of Internet Explorer in a separate window, rather than use the Browser control that comes with the .NET platform.

Unfortunately, it proved almost impossible to find any references to the interfaces necessary to do the job.

This is a very simple program that allows the user to type a URL into a textbox, and then opens IE directly to that URL.

This only works with IE4 and above.

The heart of the code is exposing the IWebBrowserApp interface. This interface is located in the SHDocVw.dll, which can be found (on Win2K/Xp) in the System32 directory.

The source code is simple:

Imports SHDocVw
Sub OpenBrowser(ByVal url As String) '
Dim o As Object = Nothing
Dim ie As New SHDocVw.InternetExplorerClass
Dim wb As IWebBrowserApp = CType(ie, IWebBrowserApp)
wb.Visible =
True
'Do anything else with the window here that you wish
wb.Navigate(url, o, o, o, o)
End Sub 'OpenBrowser

I hope this is useful to others.

share this article :
post comment
 

any idea on getting this instince of IE to open in a Windows Form

Posted by Jonik Jun 14, 2010

After creating an instance of IE in this manner is it possible to navigate to a url in a new tab?

Posted by Harry Dablett Apr 09, 2010

Imports SHDocVw
Sub OpenBrowser(ByVal url As String)
'
Dim o As Object =
Nothing
Dim ie As New
SHDocVw.InternetExplorerClass
Dim wb As IWebBrowserApp = CType
(ie, IWebBrowserApp)
wb.Visible =
True
'Do anything else with the window here that you wish
wb.Navigate(url, o, o, o, o)
End Sub
'OpenBrowser

are these code is juz copy and and pasts in a cmdbutton? then can browse internet?

Posted by lee chin Dec 27, 2009
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor