-
C#打开指定网页的方法
一、
程序代码
ShellExecuteA(this.Handle,"open","http://www.caogenit.com ",null,"",5);
二、
程序代码
System.Diagnostics.Process.Start(e.LinkText);//打开网页
System.Diagnostics.Process.Start(filename);//加载文件
三、
程序代码
using System.Diagnostics;
Process ps=new Process();
ps.StartInfo.FileName="iexplore.exe";
ps.StartInfo.Arguments=" http://www.caogenit.com";
ps.Start();
- C#在默认浏览器中打开网页
[csharp]
using System.Text.RegularExpressions;
using Microsoft.Win32;
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
string s = key.GetValue("").ToString();
Regex reg = new Regex("\"([^\"]+)\"");
MatchCollection matchs = reg.Matches(s);
string filename="";
if (matchs.Count > 0) www.2cto.com
{
filename = matchs[0].Groups[1].Value;
System.Diagnostics.Process.Start(filename, AppUtils.configSetting.WebUri);
}
通过注册表取得默认 浏览器的路径,然后用进程打开即可
本文介绍了使用C#语言在Windows环境下打开指定网页的多种方法,包括直接启动默认浏览器、利用IE浏览器进程以及通过注册表读取默认浏览器路径等方式。
3744

被折叠的 条评论
为什么被折叠?



