Tom Wilson

Tom Wilson

  • NA
  • 3
  • 0

How do I open an explorer window in C#?

Oct 11 2008 10:54 AM

I'm having no luck with this or finding a solution.  Any help appreciated.  I'm trying to open an explorer window from within a C# app.  I'm using the following code.:

Process.Start("explorer.exe", "C:\\");

When I run this, the explorer window opens just fine and then the application crashes in program.cs at this line:

Application.Run(new Form1());

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Any ideas?  It's contained in a context menu event and there is no other code.  If I step through it line by line the window opens and control returns to the program no problem.  Run it without a breakpoint and the app crashes every time after the window opens.

Am I using the wrong method?  I've tried countless variations of the same thing and each example I try has the same result; the window opens fine and the app crashes in the background.

Any help appreciated, thanks!

 


Answers (2)