当父程序终止时,Process.Start是否终止子程序? [英] Does Process.Start terminate the child program when the parent terminates?

查看:55
本文介绍了当父程序终止时,Process.Start是否终止子程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Process.Start(exepath); 开始的程序是否在父进程结束时终止?我收到一些奇怪的行为,并认为可能是问题所在.

Do programs started with Process.Start(exepath); terminate when the parent process ends? I'm getting some strange behavior with it and believe that could be the issue.

推荐答案

您的问题的简短答案是不,不是".您必须明确杀死它们.如果要杀死已启动的进程,则可以使用process.start返回的句柄.像这样

The short answer to your question is No, they don't. You will have to kill them explicitly.If you want to kill the process that you have started then you can use the handle returned by process.start. Something like this

Process p = Process.Start("someprocess");
if (p != null)
  p.Kill();

这篇关于当父程序终止时,Process.Start是否终止子程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆