从 WinForms 应用程序启动 URL [英] Launch a URL from a WinForms app

查看:42
本文介绍了从 WinForms 应用程序启动 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 VB.NET WinForms 应用程序,我需要在其中将用户引向带有文档/帮助的网页.我意识到 LinkBut​​ton 可以完成这个技巧,但我想要的是一个标准的 Button 控件,用于在单击该按钮时启动系统默认浏览器.我能找到的唯一代码引用了 Win32 API,挂钩了 ShellExecute 命令:

I've got a VB.NET WinForms app in which I have the need to refer the user to a web page with documentation/help. I realize the LinkButton would get the trick done, but what I want is a standard Button control to launch the system default browser when that button is clicked. The only code I can find references the Win32 API, hooking the ShellExecute command:

ShellExecute(Me.Handle.ToInt32, "Open", "http://www.stackoverflow.com/", CStr(0), CStr(0), WindowStyle.SW_MAXIMIZE)

有没有其他人知道如何以适当且纯粹的".NET 方式执行此操作?

Does anyone else know how to do this in a "proper and pure" .NET manner?

推荐答案

System.Diagnostics.Process.Start("http://www.website.com");

应该可以

这篇关于从 WinForms 应用程序启动 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆