代码如下 | 复制代码 |
//触发退出程序事件 privatevoidbutton1_Click(objectsender, EventArgs e) { Application.ExitThread(); Thread thtmp =newThread(newParameterizedThreadStart(run)); objectappName = Application.ExecutablePath; Thread.Sleep(1); thtmp.Start(appName); } privatevoidrun(Object obj) { Process ps =newProcess(); ps.StartInfo.FileName = obj.ToString(); ps.Start(); } |
注:Process 的命名空间为:System.Diagnostics;