时间:2021-05-22 08:41:10 | 栏目:C代码 | 点击:次
实例如下:
//触发退出程序事件 private void button1_Click(object sender, EventArgs e) { Application.ExitThread(); Thread thtmp = new Thread(new ParameterizedThreadStart(run)); object appName = Application.ExecutablePath; Thread.Sleep(1); thtmp.Start(appName); } private void run(Object obj) { Process ps = new Process(); ps.StartInfo.FileName = obj.ToString(); ps.Start(); }
注:Process 的命名空间为:System.Diagnostics;