title: How to close specific file explorer in C#?
body: <p>It is fairly easy to close a file explorer based on its window name, like this:</p>
  
  <p>msWinHelper Class:</p>
  
  <pre><code>    [DllImport("user32.dll", SetLastError = true)]
      public static extern IntPtr FindWindow(string strClassName, string strWindowName);
      [DllImport("user32.dll", SetLastError = true)]
      public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
  
      static uint WM_CLOSE = 0x10;
  
      public IntPtr findWindow(string className, string name)
      {
          return FindWindow(className, name);
      }
  
      public void closeWindow(string className, string windowName)
      {
          SendMessage(findWindow(className, windowName), WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
      }
  </code></pre>
  
  <p>Main program:</p>
  
  <pre><code>msWinHelper.closeWindow(null, "WindowName");
  </code></pre>
  
  <p>However in some occasions this is not sufficient. Lets say I have two directories with the same subdirectories. If I open a subdir <code>DIR1</code> from parent folder <code>FOLD1</code> and another <code>DIR1</code> from <code>FOLD2</code>, window names become the same. Therefore code cannot determine which is the parent folder and would not necessarily close the one I want.</p>
  
  <p>Is it possible to close an opened folder based on its full path?</p>