使用标准浏览器打开URL。 [英] Open URL with standard browser.
问题描述
嗨。
我在Usenet和网上搜索了这个简单的信息,但确实没有找到任何东西。
如何在系统的标准浏览器中打开URL? (VB6,VC ++你
可以很容易地使用ShellExecute()函数。)
MSDN的LinkLabel控件示例不起作用,因为我得到的文件没有
发现异常当System.Diagnostics.Process.Start()方法。
是否有任何独立于平台的解决方案?是否有解决方案
for Windows?
问候,
Jan
Jan。
您可以粘贴启动流程点击链接标签的代码吗?
Shak。
" Jan Krumsiek" < JA ********** @ gmx.de>在消息中写道
新闻:MP ************************ @ news.t-online.com ... < blockquote class =post_quotes>嗨。
我在Usenet和网页上搜索了这个简单的信息,但确实找不到任何东西。
我怎么能在系统的标准浏览器中打开URL? (VB6,VC ++你可以很容易地使用ShellExecute()函数。)
MSDN的LinkLabel控件示例不起作用,因为我得到了找不到文件的异常。当System.Diagnostics.Process.Start()方法时。
是否有任何独立于平台的解决方案?是否有针对Windows的解决方案?
问候,
Jan
Jan ,
当您在Process类上调用Start时,
ProcessStartInfo的实例是否将UseShellExecute属性设置为true?
-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com
" Jan Krumsiek" < JA ********** @ gmx.de>在消息中写道
新闻:MP ************************ @ news.t-online.com ... < blockquote class =post_quotes>嗨。
我在Usenet和网页上搜索了这个简单的信息,但确实找不到任何东西。
我怎么能在系统的标准浏览器中打开URL? (VB6,VC ++你可以很容易地使用ShellExecute()函数。)
MSDN的LinkLabel控件示例不起作用,因为我得到了找不到文件的异常。当System.Diagnostics.Process.Start()方法时。
是否有任何独立于平台的解决方案?有没有针对Windows的解决方案?
问候,
Jan
Shakir Hussain写道:你能粘贴代码启动进程点击链接标签吗?
当然我使用的是Microsoft示例代码。我有一个名为
" emailLink"的LinkLabel。在加载表单时,我使用:
linkEmail.Text ="点击此处获取更多信息。" ;;
linkEmail.Links.Add(6,4," ; www.microsoft.com");
//然后:
private void linkEmail_LinkClicked(对象发件人,
System.Windows.Forms.LinkLabelLinkClickedEventArgs e){
linkEmail.Links [linkEmail.Links.IndexOf(e.Link)]。访问= true;
System.Diagnostics.Process.Start(e.Link.LinkData.T oString());
// ^^^^^^^^^^此行抛出异常
}
(我知道这个链接还不是一个电子邮件地址,但仍然是
microsoft代码在那里)
问候,
Jan
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
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
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
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
这篇关于使用标准浏览器打开URL。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!