473,395 Members | 1,495 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.

Open URL with standard browser.

Hi.

I searched the Usenet and the Web for this simple information but did
not really find anything.
How can I open URL in the standard browser of the system? (VB6, VC++ you
could easily use the ShellExecute() function for this.)
The LinkLabel control example of MSDN does not work as I get a "file not
found exception" when System.Diagnostics.Process.Start() method.

Is there any platform-independent solution at all? Is there a solution
for Windows?
Regards,

Jan
Nov 16 '05 #1
13 28413
Jan.

Can you paste the code launching the process clicking link label?

Shak.
"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Hi.

I searched the Usenet and the Web for this simple information but did
not really find anything.
How can I open URL in the standard browser of the system? (VB6, VC++ you
could easily use the ShellExecute() function for this.)
The LinkLabel control example of MSDN does not work as I get a "file not
found exception" when System.Diagnostics.Process.Start() method.

Is there any platform-independent solution at all? Is there a solution
for Windows?
Regards,

Jan

Nov 16 '05 #2
Jan,

When you are calling Start on the Process class, does the instance of
ProcessStartInfo have the UseShellExecute property set to true?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Hi.

I searched the Usenet and the Web for this simple information but did
not really find anything.
How can I open URL in the standard browser of the system? (VB6, VC++ you
could easily use the ShellExecute() function for this.)
The LinkLabel control example of MSDN does not work as I get a "file not
found exception" when System.Diagnostics.Process.Start() method.

Is there any platform-independent solution at all? Is there a solution
for Windows?
Regards,

Jan

Nov 16 '05 #3
Shakir Hussain wrote:
Can you paste the code launching the process clicking link label?


Sure I used the Microsoft example code. I have a LinkLabel called
"emailLink". When loading the form I use:
linkEmail.Text = "Click here to get more info.";
linkEmail.Links.Add(6,4,"www.microsoft.com");

// and then:

private void linkEmail_LinkClicked(object sender,
System.Windows.Forms.LinkLabelLinkClickedEventArgs e){

linkEmail.Links[linkEmail.Links.IndexOf(e.Link)].Visited = true;
System.Diagnostics.Process.Start(e.Link.LinkData.T oString());
// ^^^^^^^^^^ this line throws an exception

}

(i know the link is not yet an email address but there's still the
microsoft code in there)
Regards,
Jan
Nov 16 '05 #4
Hi Jan,

If you use Process.Start( "document.ext" ) ;

it will create a new process and will use the application associated with
".ext"

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Hi.

I searched the Usenet and the Web for this simple information but did
not really find anything.
How can I open URL in the standard browser of the system? (VB6, VC++ you
could easily use the ShellExecute() function for this.)
The LinkLabel control example of MSDN does not work as I get a "file not
found exception" when System.Diagnostics.Process.Start() method.

Is there any platform-independent solution at all? Is there a solution
for Windows?
Regards,

Jan

Nov 16 '05 #5
Jan,

Try this. Please make sure that e.Link.LinkData.ToString() gets you the
string value. If its null, it wont work.

linkEmail.Links[linkEmail.Links.IndexOf(e.Link)].Visited = true;

Process linkLabelProc= new Process();
linkLabelProc.StartInfo.FileName = @"iexplore.exe";
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();
linkLabelProc.Start();

Shak
"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Shakir Hussain wrote:
Can you paste the code launching the process clicking link label?


Sure I used the Microsoft example code. I have a LinkLabel called
"emailLink". When loading the form I use:
linkEmail.Text = "Click here to get more info.";
linkEmail.Links.Add(6,4,"www.microsoft.com");

// and then:

private void linkEmail_LinkClicked(object sender,
System.Windows.Forms.LinkLabelLinkClickedEventArgs e){

linkEmail.Links[linkEmail.Links.IndexOf(e.Link)].Visited = true;
System.Diagnostics.Process.Start(e.Link.LinkData.T oString());
// ^^^^^^^^^^ this line throws an exception

}

(i know the link is not yet an email address but there's still the
microsoft code in there)
Regards,
Jan

Nov 16 '05 #6
Jan,

to open default browser and mail client you have to do this

linkLabelProc.StartInfo.FileName = e.Link.LinkData.ToString(); //can be URL
or mailto::

remove this line from my previous example
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();

Shak

"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Shakir Hussain wrote:
linkEmail.Links[linkEmail.Links.IndexOf(e.Link)].Visited = true;

Process linkLabelProc= new Process();
linkLabelProc.StartInfo.FileName = @"iexplore.exe";
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();
linkLabelProc.Start();


Thank you Shak, that code works... but it always uses IE instead of the
standard browser. Additionally I would like to use "mailto:" links to
open the email client which does not work very well with the code above.
Regards,

Jan Krumsiek

Nov 16 '05 #7
Nicholas Paldino [.NET/C# MVP] wrote:
When you are calling Start on the Process class, does the instance of
ProcessStartInfo have the UseShellExecute property set to true?


Hello Nicholas
I tried this code
using System.Diagnostics;

// ...
// ...
// ...

ProcessStartInfo psi = new ProcessStartInfo("http://www.microsoft.com");
psi.UseShellExecute = true;

Process.Start(psi);

still does not work

Regards,
Jan
Nov 16 '05 #8
Shakir Hussain wrote:
linkEmail.Links[linkEmail.Links.IndexOf(e.Link)].Visited = true;

Process linkLabelProc= new Process();
linkLabelProc.StartInfo.FileName = @"iexplore.exe";
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();
linkLabelProc.Start();


Thank you Shak, that code works... but it always uses IE instead of the
standard browser. Additionally I would like to use "mailto:" links to
open the email client which does not work very well with the code above.
Regards,

Jan Krumsiek
Nov 16 '05 #9
Shakir Hussain wrote:
Jan,

to open default browser and mail client you have to do this

linkLabelProc.StartInfo.FileName = e.Link.LinkData.ToString(); //can be URL
or mailto::

remove this line from my previous example
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();


No, that's almost the same issue as in my original posting. This does
NOT work. It throws a "file not found" exception if there is a URL in
StartInfo.Filename .
Regards,

Jan
Nov 16 '05 #10
Jan,

to open default browser and mail client you have to do this

linkLabelProc.StartInfo.FileName = e.Link.LinkData.ToString(); //can be URL
or mailto::

remove this line from my previous example
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();

Shak

"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Shakir Hussain wrote:
linkEmail.Links[linkEmail.Links.IndexOf(e.Link)].Visited = true;

Process linkLabelProc= new Process();
linkLabelProc.StartInfo.FileName = @"iexplore.exe";
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();
linkLabelProc.Start();


Thank you Shak, that code works... but it always uses IE instead of the
standard browser. Additionally I would like to use "mailto:" links to
open the email client which does not work very well with the code above.
Regards,

Jan Krumsiek

Nov 16 '05 #11
Shakir Hussain wrote:
Jan,

to open default browser and mail client you have to do this

linkLabelProc.StartInfo.FileName = e.Link.LinkData.ToString(); //can be URL
or mailto::

remove this line from my previous example
linkLabelProc.StartInfo.Arguments = e.Link.LinkData.ToString();


No, that's almost the same issue as in my original posting. This does
NOT work. It throws a "file not found" exception if there is a URL in
StartInfo.Filename .
Regards,

Jan
Nov 16 '05 #12
You can figure out the default browser by reading the registry value
HKCR\HTTP\shell\open\command. Read the value and open it with
System.Diagnostics.Process.Start.

Robert
"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Hi.

I searched the Usenet and the Web for this simple information but did
not really find anything.
How can I open URL in the standard browser of the system? (VB6, VC++ you
could easily use the ShellExecute() function for this.)
The LinkLabel control example of MSDN does not work as I get a "file not
found exception" when System.Diagnostics.Process.Start() method.

Is there any platform-independent solution at all? Is there a solution
for Windows?
Regards,

Jan

Nov 16 '05 #13
You can figure out the default browser by reading the registry value
HKCR\HTTP\shell\open\command. Read the value and open it with
System.Diagnostics.Process.Start.

Robert
"Jan Krumsiek" <ja**********@gmx.de> wrote in message
news:MP************************@news.t-online.com...
Hi.

I searched the Usenet and the Web for this simple information but did
not really find anything.
How can I open URL in the standard browser of the system? (VB6, VC++ you
could easily use the ShellExecute() function for this.)
The LinkLabel control example of MSDN does not work as I get a "file not
found exception" when System.Diagnostics.Process.Start() method.

Is there any platform-independent solution at all? Is there a solution
for Windows?
Regards,

Jan

Nov 16 '05 #14

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

Similar topics

6
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page...
7
by: Anna | last post by:
Hi all. I have a (hopefully) pretty simple question. I open a link in a new window: <a href="http://www.somewhere.com/some.hml"...
4
by: simon lee | last post by:
Dear all, I have a html code like <a href="product.html" target=new>product</a> Although the file "product.html" can be opened at the new page, but with scrollbar, menu, location, and so...
3
by: Steve Dorsey | last post by:
Hello I'm creating a web page that contains a flash presentation. I currently have it resizing the user's web page and placing it on the screen using this script: ...
7
by: Mark | last post by:
Hello; Here is what I wish to do: Click on a PDF link and have it open as a full screen window - not as a predetermined size. Sounds simple? I want to run the command from within the...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
3
by: Bob | last post by:
I am trying to create a popup page (to act as a menu) from a parent page. When the parent page (index.jsp) calls my popup function (see below) it will properly open the correct size browser window...
6
by: Mateo | last post by:
Hi! I tried to open page in new window with window.open(...) method. open() method supports fullscreeen mode, but I would like to open new maximized window with tiltle bar only.... Any idea...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
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: 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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.