Reputation: 2983
I have a C# winforms application that I am using. I have a "browse output folder" button that takes the user to a specific path on a network drive for our local systems.
However, I have been getting these weird exceptions from Explorer.exe where it crashes for no particular reason with no real error message. This occurs when the folder opens up properly and sits for a while, it will open a message saying that it "has stopped working" and asks me to close it. This issue is very repeatable.
My best guess at the issue is that it is a network related problem. The network has been known to be glitchy occasionally (goes up/down briefly fairly often). Could this cause the problem?
The code I use is (I do typically check that the folder path is valid):
string Path = "\\\\serverPath\\data\\My Folder\\";
System.Diagnostics.Process.Start("Explorer.exe", Path);
Basic question summary: Am I making this call to Explorer.exe improperly / is there a better/safer way of doing this to avoid this problem?
EDIT: OR is as I expected and is just a windows bug that I'm going to have to deal with... =(
Upvotes: 1
Views: 1450
Reputation: 55402
If you want an alternative way of opening the folder try using SHOpenFolderAndSelectItems
. To open a folder I think you can use the same PCITEMIDLIST as the parent and the selection:
SHOpenFolderAndSelectItems(folder, 1, &folder, 0);
Upvotes: 2