Answering the follow-up Question: how to get the open folder from Explorer?
You can locate Explorer's main windows using the class
System.Diagnostics.Process
. The property System.Diagnostics.Process.MainWindowTitle will give your the current open folder, see
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.mainwindowtitle.aspx[
^].
But why? Explorer in just one of the many applications which can access file structure. There is too much bothering about identification of the instances of Explorer process, but what's the use? There is nothing special about this application. Running it makes no difference in the system. By the way, there is a number of alternative file managers, much better then Explorer. Whatever you do with the Explorer, I see no sense.
—SA