deltonio2
deltonio2

Reputation: 1809

Can't start explorer process in c#, just the window file explorer

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!

Upvotes: 5

Views: 2169

Answers (1)

DotThoughts
DotThoughts

Reputation: 789

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.

Upvotes: 6

Related Questions