5

I would like launch the explorer process, with the taskbar, etc. , but when I launch it (in code) I just have the window of file explorer that open, and not the rest. But if I execute "explorer.exe" in the taskManager it works. It's just when I execute this on a Windows 7 64bits machine. On a Windows 7 32bits, it works! Si how can we do that for a 64bits Windows?

Here is my code:

Process Appli = new Process();
Appli.StartInfo.FileName = "explorer.exe";
Appli.StartInfo.UseShellExecute = false;
Appli.StartInfo.RedirectStandardOutput = false;
Appli.Start();

And when it execute, I just have that my desktop (without icons) with a window file explorer.

My properties plateform for this project is "Any CPU"

Can anyone help me please?

Thank’s a lot!

7
  • Yes you do get this behavior when loading explorer. Older versions of windows used to get this from task manager as well but not on newer. I believe it must detect the process launching it when the exe is loading and swaps behavior. Apr 1, 2014 at 14:12
  • What is the reason for loading explorer directly? Apr 1, 2014 at 14:12
  • Have you tried passing a directory as an argument to explorer.exe?
    – andyp
    Apr 1, 2014 at 14:13
  • 1
    Here is a console app that restarts explorer stackoverflow.com/a/10438722/956658 Apr 1, 2014 at 14:19
  • possible duplicate of How to programatically restart windows explorer process Apr 1, 2014 at 14:23

1 Answer 1

6

Even if you specify AnyCPU, Visual Studio may specify the "prefer 32 bit" option by default. If that is the case, then explorer.exe that it spawns will be a 32 bit process and wont be the shell.

If you turn off the "prefer 32 bit" flag under project properties/Build, then your application will run as a 64 bit app, and will spawn the 64 bit explorer.exe as the shell.

1
  • Excellent...glad to be of help! Apr 3, 2014 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.