|
[code=csharp] /// <summary>
/// 调用默认IE打开网页
/// </summary>
/// <param name="strUrl"></param>
public static void OpenUrl(string strUrl)
{
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
string s = key.GetValue("").ToString();
int iIndex = s.LastIndexOf(".exe") + 3;
string BrowsePath = s.Substring(1, iIndex);//"Ccation\360se.exe" -- "%1"
//s就是你的默认浏览器,不过后面带了参数,把它截去
try
{
System.Diagnostics.Process.Start(BrowsePath, strUrl);
//System.Diagnostics.Process.Start("iexplore.exe", strUrl);
}
catch (Exception ex)
{
System.Diagnostics.Process.Start("iexplore.exe", strUrl);
}
}[/code]
|
|