C#调用C++的EXE

来源:互联网 发布:java final 修饰类 编辑:程序博客网 时间:2024/05/16 10:25
private void button1_Click(object sender, EventArgs e)
{
  Process process = new Process();
  //process.StartInfo.WorkingDirectory = "c:\\GetName.exe";//EXE觉得路劲
  process.StartInfo.FileName = "GetName.exe";//同路劲下的EXE
  process.StartInfo.Arguments = "5";//传入的参数


  //UseShellExecute表示是否从控制台启动。如果想从标准输出流中读取输出,这个属性必需设为False

  //若要使用 StandardOutput,必须将 ProcessStartInfo.UseShellExecute 设置为 false,并且将ProcessStartInfo.RedirectStandardOutput 设置为 true

  process.StartInfo.UseShellExecute = false;


  process.StartInfo.CreateNoWindow = true;//不显示窗口
  process.Start();//启动
}

 

0 0
原创粉丝点击