等到过程结束

编程入门 行业动态 更新时间:2024-10-27 00:28:32
本文介绍了等到过程结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有哪些做一个应用程序

I've an application which does

Process.Start()

要启动其他应用程序ABC。我想等到该应用程序端(进程死亡),并继续我的执行。我该怎么办呢?

to start another application 'ABC'. I want to wait till that application ends (process dies) and continue my execution. How can I do it?

有可能是ABC的应用程序在同一时间运行多个实例。

There may be multiple instances of the application 'ABC' running at the same time.

推荐答案

我觉得你只是想这样的:

I think you just want this:

var process = Process.Start(...); process.WaitForExit();

请参见 MSDN页的方法。它还具有过载,你可以指定超时,所以你不会有可能永远等待。

See the MSDN page for the method. It also has an overload where you can specify the timeout, so you're not potentially waiting forever.

更多推荐

等到过程结束

本文发布于:2023-11-02 13:35:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552540.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:过程   结束

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!