主程序调用外部程序的4种方法介绍:
1. 启动外部程序,不等待其退出。
2. 启动外部程序,等待其退出。
3. 启动外部程序,无限等待其退出。
4. 启动外部程序,通过事件监视其退出。
using System.Diagnostics.Process.Start()
private string appName = “”; //应用程序路径或名称
/// <summary>
/// 1. 启动外部程序,不等待其退出
/// </summary>
private void button1_Click(object sender, EventArgs e)
{
Process.Start(appName);
MessageBox.Show(String.Format("外部程序 {0} 启动完成!", this.appName), this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
/// <summary>
/// 2. 启动外部程序,等待其退出
/// </summary>
pri