5

我想使用 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?

4

1 回答 1

1

处理进程退出事件:

editProcess.Exited += process_Exited;
于 2010-08-31T15:41:35.720 回答