从 C# 启动新的 explorer.exe 进程
如果我运行此命令:
C:\WINDOWS\explorer.exe "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{2227A280-3AEA-1069-A2DE-08002B30309D}"
从 Windows shell(通过 Windows+R),我的打印机和传真将在新 资源管理器中打开.exe
进程。 (所以我有 2 个正在运行的 explorer.exe
进程。)
如果我从 C# 程序执行:
Process.Start(@"C:\WINDOWS\explorer.exe", @"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\" +
@"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\" +
@"::{2227A280-3AEA-1069-A2DE-08002B30309D}");
我的打印机和传真也会打开,但作为主 explorer.exe< 的子进程/code> 进程(运行 Windows shell 的进程,包括任务栏等)。
如何从 C# 启动第二个带有打印机和传真窗口的 explorer.exe
进程?
If I run this command:
C:\WINDOWS\explorer.exe "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}\::{2227A280-3AEA-1069-A2DE-08002B30309D}"
from the Windows shell (via Windows+R), my printer and faxes open in a new explorer.exe
process. (So I have 2 running explorer.exe
processes.)
If i execute:
Process.Start(@"C:\WINDOWS\explorer.exe", @"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\" +
@"::{21EC2020-3AEA-1069-A2DD-08002B30309D}\" +
@"::{2227A280-3AEA-1069-A2DE-08002B30309D}");
from a C# program, my printer and faxes open too, but as an child process of the main explorer.exe
process (the one running the Windows shell, including the taskbar, etc.).
What can I do to start a second explorer.exe
process with the printer and faxes window from C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
初步想法 - 检查文件夹选项中的“在单独的进程中启动文件夹窗口”(组织 -> 文件夹和搜索选项 -> 查看选项卡)。默认情况下未选中此选项,因此“检查”此选项并再次尝试您的 C# 代码。
我知道此设置会影响 ShellExecute 函数,但我不确定 .NET 的诊断命名空间是否使用相同的路由。
ShellExecute(句柄, "探索", , NULL, NULL, SW_SHOWNORMAL);
第二个想法 - stackoverflow 中已经讨论了类似的问题,这篇文章可能会给您一些想法。
启动新进程,而不是该进程的子进程产卵过程
Initial thoughts - check your "Launch folder windows in a separate process" in Folder Options (Organize -> Folder & Search Options -> View tab). This is unchecked by default, hence "Check" this and try your C# code again.
I know this setting affects the ShellExecute function but I am not sure if .NET's Diagnostic namespace uses the same route.
ShellExecute(handle, "explore", , NULL, NULL, SW_SHOWNORMAL);
Second thoughts - a similar issue has been already discussed in stackoverflow and this post might give you some idea.
Start new process, without being a child of the spawning process