//调用middleware目录下的middleware.exe,并等待该程序执行结束
Process p = new Process();
p.StartInfo.FileName =
midServerPath(serverMidFilePath, false)
+ @"\middleware.exe";//设定程序名 
p.StartInfo.UseShellExecute = false;//Shell的使用
p.StartInfo.CreateNoWindow = false;//设定不显示窗口
p.EnableRaisingEvents = true;//事件的使用
p.Exited += exeplu_Exited;//调用的事件
p.Start();
p.WaitForExit();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// <summary>
/// 程序执行结束后执行结果(Plu下发接口)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void exeplu_Exited(object sender, EventArgs e)
{
    string umtScaleCMDSql = "select executeResult
    from UMTScaleCMD where  CMDSN='" + scaleCMD + "'";
    pluDT = GetTable(umtScaleCMDSql, this.serverMidFilePath);
    //清空middleware目录下的ScaleCMD.ini
    //文件中的[ScaleCMD]路径下的SN的内容
    string scaleCmdPath = midServerPath(serverMidFilePath, false)
    + @"\ScaleCMD.ini";
    IniWriteValue(scaleCmdPath, "ScaleCMD", "SN", "");

转载优特建站:http://www.youtiy.com/Articles/Item.aspx?Id=290