【发布时间】:2011-06-02 07:17:34
【问题描述】:
我想使用 shell 可执行文件以尊重用户对要启动的应用程序的偏好,但我还需要知道该特定应用程序何时关闭。
Process editProcess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = filename;
startInfo.Verb = "edit";
startInfo.UseShellExecute = true;
editProcess.StartInfo = startInfo;
// start the default editor
editProcess.Start();
editProcess.WaitForExit();
WaitForExit 似乎在 shell 进程退出时返回,而不是在实际进程退出时返回。
有没有比手动解析注册表、找到正确的应用程序来启动并在不执行 shell 的情况下显式启动该应用程序更好的方法来了解启动的应用程序何时退出?
【问题讨论】:
-
我遇到了类似的问题。你设法解决了这个问题吗?
-
你发现了吗?
标签: c# .net shellexecute