473,385 Members | 1,546 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,385 software developers and data experts.

Opening a browser using system.disgnostics.process class

I'm trying to open an instance of the default browser and browse to a URL.

I'm seeing an issue with the process class where if i execute my process
using this code
Dim p As Process = New Process
p.StartInfo.Arguments = "www.starwars.com"
p.StartInfo.FileName = "iexplore.exe"
p.Start()
p.CloseMainWindow()
Dim c As Boolean = p.HasExited

i can consume events and access properties of the process class after i
execute start(like closemainwindow). When i use the code below i cannot
reference properties of the process class.

Dim q As New Process
q.Start("www.starwars.com")
p.CloseMainWindow()
Dim b As Boolean = q.HasExited

Anyone have any ideas as to why this is the case. Additionally i'd also like
to know if there is a way to get the exe path of the default browser.

Thanks,
Shawn
Jul 21 '05 #1
2 1588
Hi Shawn,

I'm guessing that you can't consume the events when you pass an url as
process parameter because windows is responsible for launching the web
browser.

As for the path to the default web browser, I don't know.
You can obtain the paths to various web browsers using

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Curr entVersion\App Paths\

and the individual IEXPLORE.EXE, OPERA.EXE
Also, just passing "iexplore.exe" as a process parameter may not always
work and you should use the full path instead.

--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2
Since you want to start the default browser you can actually do this:

System.Diagnostics.Process.Start("http://msdn.microsoft.com");

"Shawn Hogan" wrote:
I'm trying to open an instance of the default browser and browse to a URL.

I'm seeing an issue with the process class where if i execute my process
using this code
Dim p As Process = New Process
p.StartInfo.Arguments = "www.starwars.com"
p.StartInfo.FileName = "iexplore.exe"
p.Start()
p.CloseMainWindow()
Dim c As Boolean = p.HasExited

i can consume events and access properties of the process class after i
execute start(like closemainwindow). When i use the code below i cannot
reference properties of the process class.

Dim q As New Process
q.Start("www.starwars.com")
p.CloseMainWindow()
Dim b As Boolean = q.HasExited

Anyone have any ideas as to why this is the case. Additionally i'd also like
to know if there is a way to get the exe path of the default browser.

Thanks,
Shawn

Jul 21 '05 #3

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

Similar topics

14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
3
by: Michel H | last post by:
Hello everyone, While it seems simple to me, I just want to have a URL in my windows application that people can click and then launch the URL in the default browser. Same thing with a mailto:...
3
by: Alucard | last post by:
Hello all, I would like to know how to programmatically open the system default browser with a specified URL? For example, clicking a button to open up a browser window loaded with a specified...
6
by: Mike Fellows | last post by:
when i click a button i want to open the machines default web browser to a specific page how do i do this? Regards Michael Fellows
2
by: Shawn Hogan | last post by:
I'm trying to open an instance of the default browser and browse to a URL. I'm seeing an issue with the process class where if i execute my process using this code Dim p As Process = New Process...
15
by: tshad | last post by:
I was looking for a way to handle refreshes (user pressed refresh button) and found a piece of code to check if a Web page was refreshed but I can't get it to work. The code is:...
4
by: Guern1 | last post by:
Hi Need a bit of help here please to point me in the right direction. I have a java class file here which i wish from a menu item to open a web page which contains a help page. ] } else...
5
by: Anil Gupte/iCinema.com | last post by:
Sorry reposting for clarity... Which one is better? This: System.Diagnostics.Process.Start(URL) or this? Dim psi As New ProcessStartInfo() psi.UseShellExecute = True
2
by: beanz80 | last post by:
I was recently tasked with creating a .NET application that opens the default browser to a specific webpage with the user name and password populated. I have found the following code that uses C#...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.