直接上代码啦>v<
private static bool OpenBrowser(string url)
{
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@”http\shell\open\command\”);
string val = key.GetValue(“”).ToString();
string browserpath = null;
if (val.StartsWith(“\””))
{
browserpath = val.Substring(1, val.IndexOf(‘\”‘, 1) – 1);
}
else
{
browserpath = val.Substring(0, val.IndexOf(” “));
}
return System.Diagnostics.Process.Start(browserpath, url) != null;
}

发表评论