调用winform程序

/// <summary>
/// 打开EXE
/// </summary>
/// <param name="filename">EXX路径</param>
/// <param name="args">参数</param>
/// <returns></returns>
Process myprocess = null;
ProcessStartInfo startInfo = null;
public bool StartProcess(string filename, string str)
{
try
{
myprocess = new Process();
startInfo = new ProcessStartInfo(filename, str.Trim());
myprocess.StartInfo = startInfo;

//通过以下参数可以控制exe的启动方式,具体参照 myprocess.StartInfo.下面的参数,如以无界面方式启动exe等
myprocess.StartInfo.UseShellExecute = false;
myprocess.Start();
return true;
}
catch (Exception ex)
{
//MessageBox.Show("启动应用程序时出错!原因:" + ex.Message);
}
return false;
}

posted @ 2018-05-09 10:45  华翎科技  阅读(117)  评论(0编辑  收藏  举报