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