First we have to add the following namespace....
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
private static string GetDefaultBrowserPath()
{
string key = @"htmlfile\shell\open\command";
RegistryKey registryKey = Registry.ClassesRoot.OpenSubKey(key, false);
// get default browser path
return ((string)registryKey.GetValue(null, null)).Split('"')[1];
}
private void button1_Click(object sender, EventArgs e)
{
string url = "www.google.com";
Process p = new Process();
p.StartInfo.FileName = GetDefaultBrowserPath();
p.StartInfo.Arguments = url;
p.Start();
}
Friday, November 27, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment