示例界面:
要领一:从注册表中读取默许浏览器可执行文件途径
private void button1_Click(object sender, EventArgs e) { //从注册表中读取默许浏览器可执行文件途径 RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\"); string s = key.GetValue("").ToString(); //s就是你的默许浏览器,不过背面带了参数,把它截去,不过须要注重的是:差别的浏览器背面的参数不一样! //"D:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -- "%1" System.Diagnostics.Process.Start(s.Substring(0, s.Length - 8), "http://blog.csdn.net/testcs_dn"); }
要领二:
private void button2_Click(object sender, EventArgs e) { //挪用体系默许的浏览器 System.Diagnostics.Process.Start("explorer.exe", "http://blog.csdn.net/testcs_dn"); }
要领三:
private void button3_Click(object sender, EventArgs e) { //挪用体系默许的浏览器 System.Diagnostics.Process.Start("http://blog.csdn.net/testcs_dn"); }
要领四:挪用IE浏览器
private void button4_Click(object sender, EventArgs e) { //挪用IE浏览器 System.Diagnostics.Process.Start("iexplore.exe", "http://blog.csdn.net/testcs_dn"); }
从道理上来说,要领二和要领三应该是一样的,不过要领三的代码更短一点。
以上就是C#挪用默许浏览器翻开网页的几种要领细致引见(图)的细致内容,更多请关注ki4网别的相干文章!