title: Error looping over ShellWindows
body: <p>I occasionally get the "Error HRESULT E_FAIL has been returned from a call to a COM component." error when looping over the ShellWindows class.  Seems to happen mostly after the computer wakes from sleeping.  I have to restart my computer to clear this error which is not good.  </p>
  
  <p>The error happens on the "foreach" loop line in the following code:</p>
  
  <pre><code>log.Debug(String.Format("new ShellWindowsClass"));
  ShellWindows m_IEFoundBrowsers = new ShellWindowsClass();
  
  log.Debug(String.Format("Loop begin"));
  foreach (InternetExplorer Browser in m_IEFoundBrowsers)
  {
      log.Debug(String.Format("Browser {0} ?= {1}", Browser.HWND, pid));
      if (Browser.HWND == pid)
      {
          found = Browser;
          break;
      }
  }
  log.Debug(String.Format("Loop end"));
  </code></pre>
  
  <p>I am compiling for Dot Net Framework 3.0. </p>
  
  <p>Any suggestions for addressing this error besides restart the computer?</p>