Geeks With Blogs
Pranav`s TechNiche technical thoughts of a coffee addicted developer
This post describes how to open default web browser from a .NET Application (esp. a Windows Application).

First, copy the following code and paste it in your class.

Private Declare Function ShellExecute _

Lib "shell32.dll" _
Alias "ShellExecuteA"( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long

Then, you can use the function ShellExecute() as follows.

Private Sub Button1_Click()

Dim objBrowser As Long

objBrowser = ShellExecute(0, "open", "", 0, 0, 1)

End Sub

We can also open the default web browser as:


I usually create a Form and place a WebBrowser control in it and use it for opening any web pages. I will get back to you with that soon.

Microsoft reference for the topic, Click here

Posted on Monday, October 26, 2009 7:02 PM .NET | Back to top

Comments on this post: Opening default web browser from Windows Application

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Pranav | Powered by: