473,395 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Launching a browser

What is the command (in Windows Forms VB.NET) which will cause the
subject computer's default browser to launch, and display a specified
Web page?
--
Alan M Dunsmuir
Nov 21 '05 #1
24 2046
Hi,

Process.Start(Http://msdn.microsoft.com)

Ken
-----------------------
"Alan M Dunsmuir" <al**@moonrake.demon.co.uk> wrote in message
news:g4**************@moonrake.demon.co.uk...
What is the command (in Windows Forms VB.NET) which will cause the
subject computer's default browser to launch, and display a specified
Web page?
--
Alan M Dunsmuir
Nov 21 '05 #2
"Alan M Dunsmuir" <al**@moonrake.demon.co.uk> schrieb:
What is the command (in Windows Forms VB.NET) which will cause the subject
computer's default browser to launch, and display a specified Web page?


Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
I read the link.

Shell("http://www.yahoo.com/")

Doesn't work for me. Exception from
'System.IO.FileNotFoundException' : File not found.

What I don't like about

Process.Start(psi)

is that a new IE window is not launched, any existing IE window is
high jacked. Is there a way to launch a new window of the default
browser and point to a URL?

Thanks...
On Sat, 25 Dec 2004 13:03:18 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:

< snip >

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>

Nov 21 '05 #4
rs
try this:

System.Diagnostics.Process.Start("IExplore.exe", www.whatever.com)

that should open a new window
"- HAL9000" <gu***@mail.org> wrote in message
news:mp********************************@4ax.com...
I read the link.

Shell("http://www.yahoo.com/")

Doesn't work for me. Exception from
'System.IO.FileNotFoundException' : File not found.

What I don't like about

Process.Start(psi)

is that a new IE window is not launched, any existing IE window is
high jacked. Is there a way to launch a new window of the default
browser and point to a URL?

Thanks...
On Sat, 25 Dec 2004 13:03:18 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:

< snip >

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>


Nov 21 '05 #5
rs
thats not the default browser though.
"rs" <aa@d.com> wrote in message news:ct********************@rogers.com...
try this:

System.Diagnostics.Process.Start("IExplore.exe", www.whatever.com)

that should open a new window
"- HAL9000" <gu***@mail.org> wrote in message
news:mp********************************@4ax.com...
I read the link.

Shell("http://www.yahoo.com/")

Doesn't work for me. Exception from
'System.IO.FileNotFoundException' : File not found.

What I don't like about

Process.Start(psi)

is that a new IE window is not launched, any existing IE window is
high jacked. Is there a way to launch a new window of the default
browser and point to a URL?

Thanks...
On Sat, 25 Dec 2004 13:03:18 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:

< snip >

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>



Nov 21 '05 #6
Sorry for spelling error, this is correctly source:
System.Diagnostics.Process.Start("www.yahoo.com")

"msDev" <ne*******@mail.bg> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl...
If You want open link in default browser? See this example:

System.Siagnostics.Process.Start(www.yahoo.com)

"- HAL9000" <gu***@mail.org> wrote in message
news:mp********************************@4ax.com...
I read the link.

Shell("http://www.yahoo.com/")

Doesn't work for me. Exception from
'System.IO.FileNotFoundException' : File not found.

What I don't like about

Process.Start(psi)

is that a new IE window is not launched, any existing IE window is
high jacked. Is there a way to launch a new window of the default
browser and point to a URL?

Thanks...
On Sat, 25 Dec 2004 13:03:18 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:

< snip >

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>



Nov 21 '05 #7
Ok, yea, I've used that.

The problem, as I mentioned, is that 'Start("www.yahoo.com")' does not
start a new IE window. Any existing IE window is hijacked.

Try Process.Start for yourself with multiple IE windows open. A new
IE window doesn't launch....

Seems like their should be an argument option in the Start to open a
new window - just don't know what it is.
On Thu, 30 Dec 2004 10:27:28 +0200, "msDev" <ne*******@mail.bg> wrote:
Sorry for spelling error, this is correctly source:
System.Diagnostics.Process.Start("www.yahoo.com ")

< snip >
>
> What I don't like about
>
> Process.Start(psi)
>
> is that a new IE window is not launched, any existing IE window is
> high jacked. Is there a way to launch a new window of the default
> browser and point to a URL?

< snip >

Nov 21 '05 #8
"- HAL9000" <gu***@mail.org> schrieb:
Try Process.Start for yourself with multiple IE windows open. A new
IE window doesn't launch....


There is an option in Internet Explorer's "Tools" -> "Internet
Options..." -> "Advanced" (translated from the German version, please excuse
deviations) that gives you the control whether a new window should be opened
or an already opened window should be reused when a Web document is opened.

Alternatively you can try this code (untested and written from scratch). It
will start MSIE, even if another browser has been selected as the system's
default browser:

\\\
Imports System.Diagnostics
..
..
..
Dim psi As New ProcessStartInfo()
With psi
.FileName = "iexplore"
.Arguments = "http://www.example.org/"
End With
Process.Start(psi)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #9
Ok, I see the IE Advanced option for "Reuse Windows For Launching
Shortcuts". Looks like it defaults to "checked" on winxp
installation.

So does that mean that their is a registry entry for that IE option?
If so, can one read/modify it?

Thanks...
On Thu, 30 Dec 2004 22:36:52 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:

< snip >

There is an option in Internet Explorer's "Tools" -> "Internet
Options..." -> "Advanced" (translated from the German version, please excuse
deviations) that gives you the control whether a new window should be opened
or an already opened window should be reused when a Web document is opened.

< snip >

Nov 21 '05 #10
"- HAL9000" <gu***@mail.org> schrieb:
Ok, I see the IE Advanced option for "Reuse Windows For Launching
Shortcuts". Looks like it defaults to "checked" on winxp
installation.

So does that mean that their is a registry entry for that IE option?
If so, can one read/modify it?


I doubt that the user will be happy if a program changes this setting.

Description of the Reuse Windows for Launching Shortcuts Setting in Internet
Explorer 5.01
<URL:http://support.microsoft.com/?scid=kb;EN-US;241911>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #11
Cool, thanks !
Nov 21 '05 #12

"- HAL9000" <gu***@mail.org> wrote
Ok, I see the IE Advanced option for "Reuse Windows For Launching
Shortcuts". Looks like it defaults to "checked" on winxp
installation.

So does that mean that their is a registry entry for that IE option?
If so, can one read/modify it?


Rather than change a user's system settings, I would suggest you
throw together a fix that will suit your needs, and leave the user
keep their own settings.

One way to work around the problem is to start a new process that
loads a local HTM file, where the HTM file is a redirect to the page
you want to go to. You could create the HTM file from your program
and launch it using the Process.Start method. For an example, Paste
the following into Notepad and save it somewhere as Redirect.htm.

<HTML><HEAD>
<META http-equiv="refresh" content="0;URL=http://www.google.com"></META>
</HEAD></HTML>

Assuming you save that to D:\temp\redirect.htm, you can call it like:

Process.Start("d:\temp\redirect.htm")

(Be advised, not all browsers support the refresh directive.)

I personally don't like software that thinks it owns the system just
because I let it execute. Software that changes settings I regularly use
isn't going to remain on my system for long (if I can help it...) I
suspect your users would prefer the indirect route, rather than you
accessing various parts of their Registry.

HTH
LFS
Nov 21 '05 #13
Larry,

"Larry Serflaten" <se*******@usinternet.com> schrieb:
<HTML><HEAD>
<META http-equiv="refresh" content="0;URL=http://www.google.com"></META>
</HEAD></HTML>

Assuming you save that to D:\temp\redirect.htm, you can call it like:

Process.Start("d:\temp\redirect.htm")

(Be advised, not all browsers support the refresh directive.)


In this case providing a hyperlink to the webpage in the HTML document's
body would make it easier for the user to browse to the page {him, her}self.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #14

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote
In this case providing a hyperlink to the webpage in the HTML document's
body would make it easier for the user to browse to the page {him, her}self.


Yeah that is possible, but that would not resolve the original question; how to
launch a browser to show a specific page....

;-)
LFS
Nov 21 '05 #15
Larry,

I did not follow the question anymore when there came no answer on my
question, however now I see you are active as well in it I was curious to
your answers in this thread.

I thought that this will solve the problem of the OP (when he uses IE)

\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = _
"C:\Program Files\Internet Explorer\iexplore.exe"
pi.Arguments = "msdn.microsoft.com"
p.StartInfo = pi
p.Start()
////

Cor

"Larry Serflaten" <se*******@usinternet.com>

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote
In this case providing a hyperlink to the webpage in the HTML document's
body would make it easier for the user to browse to the page {him,
her}self.


Yeah that is possible, but that would not resolve the original question;
how to
launch a browser to show a specific page....

;-)
LFS

Nov 21 '05 #16
"Cor Ligthert" <no************@planet.nl> schrieb:
I thought that this will solve the problem of the OP (when he uses IE)

\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = _
"C:\Program Files\Internet Explorer\iexplore.exe"
pi.Arguments = "msdn.microsoft.com"
p.StartInfo = pi
p.Start()


This would fail on my system because on German Windows versions "Program
Files" is called "Programme", and Windows is not necessarily installed on
the "C" drive. Using "iexplore" only as a filename would have a bigger
chance to work on different systems.

The "best" solution for launching /MSIE/ with a certain webpage in a new
window is IMO:

\\\
Imports System.Diagnostics
..
..
..
Dim psi As New ProcessStartInfo()
With psi
.FileName = "iexplore"
.Arguments = "-new http://dotnet.mvps.org/"
End With
Process.Start(psi)
///

Command-line switches for MSIE are documented here:

INFO: Command-Line Switches for Internet Explorer 4.0
<URL:http://support.microsoft.com/?id=178058>

To make a conclusion: When showing a webpage from within a program, I
/would not/ call a specific browser. Instead, I'd launch the document in
the default browser. If the user has chosen to reuse browser instances,
then they should be reused. If the user wants the page to be shown in a
separate browser window, he/she should uncheck the option to reuse existing
browser windows.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #17
Herfried,
This would fail on my system because on German Windows versions "Program
Files" is called "Programme", and Windows is not necessarily installed on
the "C" drive. Using "iexplore" only as a filename would have a bigger
chance to work on different systems.

Interesting, in the Dutch it is just on the same name as the English one.

Otherwise I had used of course
Environment.GetFolderPath(Environment.SpecialFolde r.ProgramFiles)
However it was not to show the "best" solution, because I even did not know
how it would act on a W9x computer, just show how it could be done.

Cor


Nov 21 '05 #18

"Cor Ligthert" <no************@planet.nl> wrote
I thought that this will solve the problem of the OP (when he uses IE)


And what to do when he doesn't use IE?

<g>
LFS
Nov 21 '05 #19
Larry,
I thought that this will solve the problem of the OP (when he uses IE)
And what to do when he doesn't use IE?


Exactly therefore it was not a "best" answer, however better than nothing.

(I stopped with the chalenge by the way to much typing, I go first using the
DLL)

:-)

Cor
Nov 21 '05 #20
Larry

And because suddenly everybody (excluding you) started to talk about IE,
while it was in the beginning the Defaul Browser where Ken's first answer
did directly fit in my opinion (except that IE in that case is stealing the
acrtive browser).

Cor
Nov 21 '05 #21

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote
The "best" solution for launching /MSIE/ with a certain webpage in a new
window is IMO:


If MSIE is the desired browser, then it gets even simpler:

Shell("explorer http://www.google.com")

As long as we're on the topic, there are quite a few views that can be
gotten from that same syntax (which was brought forward from VB6).
So, just for reference, here are all that I've found so far:

Private Const sysIExplorer$ = ", ::{871C5380-42A0-1069-A2EA-08002B30309D}"
Private Const sysNetworkPlaces$ = ", ::{208D2C60-3AEA-1069-A2D7-08002B30309D}"
Private Const sysRecycleBin$ = ", ::{645FF040-5081-101B-9F08-00AA002F954E}"
Private Const sysTasks$ = ", ::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}"

Private Const sysComputer$ = ", ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
Private Const sysDesktop$ = sysComputer & " /select,"

Private Const sysDocuments$ = ", ::{450D8FBA-AD25-11D0-98A8-0800361B1103}"
Private Const sysFax$ = sysDocuments & "\Fax"
Private Const sysPictures$ = sysDocuments & "\My Pictures"

Private Const sysControlPanel$ = sysComputer & "\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"
Private Const sysAdminTools$ = sysControlPanel & "\::{D20EA4E1-3957-11d2-A40B-0C5020524153}"
Private Const sysConnections$ = sysControlPanel & "\::{7007ACC7-3202-11D1-AAD2-00805FC1270E}"
Private Const sysFonts$ = sysControlPanel & "\::{D20EA4E1-3957-11d2-A40B-0C5020524152}"
Private Const sysPrinters$ = sysControlPanel & "\::{2227A280-3AEA-1069-A2DE-08002B30309D}"
For an example, to call up the Control Panel:

Shell("explorer " & sysControlPanel, AppWinStyle.NormalFocus)

Now, the question is, do they also work on your foreign language OS?

LFS

Nov 21 '05 #22
Use ProcessStartInfo - but set the CreateNoWindow property to False.

"- HAL9000" wrote:
I read the link.

Shell("http://www.yahoo.com/")

Doesn't work for me. Exception from
'System.IO.FileNotFoundException' : File not found.

What I don't like about

Process.Start(psi)

is that a new IE window is not launched, any existing IE window is
high jacked. Is there a way to launch a new window of the default
browser and point to a URL?

Thanks...
On Sat, 25 Dec 2004 13:03:18 +0100, "Herfried K. Wagner [MVP]"
<hi***************@gmx.at> wrote:

< snip >

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>


Nov 21 '05 #23
"chili" <ch***@discussions.microsoft.com> schrieb:
Use ProcessStartInfo - but set the CreateNoWindow property to False.


I am just curious why you suggest to do that.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #24
>> Use ProcessStartInfo - but set the CreateNoWindow property to False.

I am just curious why you suggest to do that.


me too

:-)

Cor
Nov 21 '05 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hegemony Cricket | last post by:
I've found several good examples out there on how to launch a web browser from a Java application, using the Runtime exec() command. However, what I'd like to do is configure the browser that's...
2
by: Steve Barker | last post by:
Hi guys, I have written a web service, but I want clients to be able to consume it without having the .NET framework installed on their PC. The web service doesn't return any values; it is just...
1
by: billster | last post by:
Hi, I am trying to launch a new browser with the same url location as the current browser, and at the same time run some javascript. This works with <a...
1
by: David | last post by:
Hello. I've written a page for an intranet that gives the user the option of launching a Word or PowerPoint document. The code I used to force the hyperlink to launch the application rather...
4
by: Danny | last post by:
Hello again I have two quesitons about launching IE from code in access. Is there a way to do the shell command to launch IE without having to know the exact path. shell seems to be picky and...
2
by: Tim Stevens | last post by:
Hello, This is the first time I have had to resort to posting on here, as Ive always been able to find a solution to my problems in the past by browsing postings by others. So, to start with I...
1
by: memememe | last post by:
I am launching a program with a GUI from asp.net, but aparently the aspnet user doesnt use the same screen as my logged in user, how can I make the program I launch appear on the monitor? I...
6
by: sebastien | last post by:
Hi I have an asp.net application that use Session variables. What I want to do is to launch an second instance of this application by a link inside the first application. The problem is: when I...
10
by: Simon Verona | last post by:
I've decided to store my help pages on a web site rather than deliver with my application (trying to reduce the size of the install files). The web site is sort of all ready to rock and roll. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.