/// <summary>
/// 调用谷歌浏览器打开网页
/// </summary>
/// <param name="url">打开网页的链接</param>
public void OpenBrowserUrl()
{
string url = "https://www.baidu.com/";
//读取注册表
RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe");
if (registryKey != null)
{
string exePath = (string)registryKey.GetValue("");
if (!string.IsNullOrEmpty(exePath) && File.Exists(exePath))
{
Process.Start(exePath, url);
}
}
}
C# 调用谷歌浏览器打开链接
最新推荐文章于 2024-06-25 00:52:28 发布