简体   繁体   English

从C#开始一个新的explorer.exe进程

[英]Start a new explorer.exe process from C#

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. 从Windows外壳程序(通过Windows + R ),我的打印机和传真将在新的 explorer.exe进程中打开。 (So I have 2 running explorer.exe processes.) (因此,我有2个正在运行的explorer.exe进程。)

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.). 通过C#程序,我的打印机和传真也可以打开,但是作为主explorer.exe进程(运行Windows Shell的一个子进程,包括任务栏等)的子进程。

What can I do to start a second explorer.exe process with the printer and faxes window from C#? 我该怎么办才能从C#使用打印机和传真窗口启动第二个explorer.exe进程?

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. 默认情况下未选中此选项,因此请“选中”并再次尝试您的C#代码。

I know this setting affects the ShellExecute function but I am not sure if .NET's Diagnostic namespace uses the same route. 我知道此设置会影响ShellExecute函数,但不确定.NET的Diagnostic命名空间是否使用相同的路由。

ShellExecute(handle, "explore", , NULL, NULL, SW_SHOWNORMAL); 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. 再想一想-类似的问题已经在stackoverflow中讨论过了,这篇文章可能会给你一些想法。

Start new process, without being a child of the spawning process 开始新的过程,而不是产生过程的孩子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM