System.Diagnostics.Process.Start("IEXPLORE.EXE","www.csj.sh.gov.cn");
解决方案 »
- 怎么设置cookie 到期后的事件处理
- visual studio 2010C#如何操作数据库
- ~~~~~~~LinqDataSource 删除数据问题~~~~~~~~~~~~~~
- vista 的 aero重叠效果是用WPF实现的吗?
- DllImport(),能不能引用相对路径的dll
- 求字符串比较优化的方法
- c#开发智能设备应用程序的时间控件问题
- 跪求(项目中):一个panel中加入10000个label时,出现System.ComponentModel.Win32Exception异常!定有高分相送!!
- c#读取txt文件的指定列
- 在IE11 下面 js window.showModalDialog返回值为undefined
- C#可以开发什么东西?
- 很菜的问题,关于DataGrid的数据更新问题
Process.Start(url);
myProcess1.StartInfo.FileName = "IEXPLORE.EXE";
myProcess1.StartInfo.Arguments = yoururl;
myProcess1.StartInfo.CreateNoWindow=true;
myProcess1.Start();
* 编程语言:Visual Studio .NET C# (Beta 2)
* 功 能:通过C#程序调用 Windows 记事本程序 编辑一个
* 名为 test.txt 的文本文件。
*
* 在整个程序中 System.Diagnostics.Process.Start(Info)
* 为主要语句。
* 如果只是单独执行一个外部程序,可用一条如下代码即可:
* System.Diagnostics.Process.Start(
* "外部程序名","启动参数");
*/using System;class test
{
static void Main()
{//声明一个程序信息类
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();//设置外部程序名
Info.FileName = "notepad.exe";//设置外部程序的启动参数(命令行参数)为test.txt
Info.Arguments = "test.txt";//设置外部程序工作目录为 C:\
Info.WorkingDirectory = "C:\\";//声明一个程序类
System.Diagnostics.Process Proc ;try
{
//
//启动外部程序
//
Proc = System.Diagnostics.Process.Start(Info);
}
catch(System.ComponentModel.Win32Exception e)
{
Console.WriteLine("系统找不到指定的程序文件。\r{0}", e);
return;
}//打印出外部程序的开始执行时间
Console.WriteLine("外部程序的开始执行时间:{0}", Proc.StartTime);//等待3秒钟
Proc.WaitForExit(3000);//如果这个外部程序没有结束运行则对其强行终止
if(Proc.HasExited == false)
{
Console.WriteLine("由主程序强行终止外部程序的运行!");
Proc.Kill();
}
else
{
Console.WriteLine("由外部程序正常退出!");
}
Console.WriteLine("外部程序的结束运行时间:{0}", Proc.ExitTime);
Console.WriteLine("外部程序在结束运行时的返回值:{0}", Proc.ExitCode);
}
}
namespace CalledIE
{
class Class_Main
{
static void Main(string[] args)
{
Console.WriteLine(
"调用IE流览器登陆“搜狐”网站!");
//在流览器中打开 http://www.sohu.com 网站
System.Diagnostics.Process.Start(
"IEXPLORE.EXE","http://jnjx.126.com");
}
}
}