我想使用 shell 执行显示一个 tiff 文件。我假设默认应用程序是照片查看器。我的问题是,当我想用 photoviewer.Kill() 终止进程时,我得到一个 System.InvalidOperationException。在 photoViewer.Start() 之后设置断点时,我意识到 photoviewer 不包含 ID。我有足够的方法杀死它吗?当它通过 dllhost.exe 运行时,我不想重新运行所有名为 dllhost 的进程并将它们全部杀死,因为我不知道 dllhost 还运行什么。
Process photoViewer = new Process();
private void StartProcessUsingShellExecute(string filePath)
{
photoViewer.StartInfo = new ProcessStartInfo(filePath);
photoViewer.StartInfo.UseShellExecute = true;
photoViewer.Start();
}
我有另一种没有 shell 执行的方法,但这种方法似乎有 dpi 问题。 没有shell执行的方法