title: c# Get process window titles
body: <pre><code>    proc.MainWindowTitle.Contains("e")
  </code></pre>
  
  <p>How does one get the window titles of all the current windows containing "e" open instead of just the Main Window using the "MainWindowTitle" and store them into a string array?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>     string[] toClose = {proc.MainWindowTitle};
                  for (int i = 0; i &lt; toClose.Length; i++)
                  {
                      string s = toClose[i];
                      int hwnd = 0;
  
                      hwnd = FindWindow(null, s);
  
                      //send WM_CLOSE system message
                      if (hwnd != 0)
                          SendMessage(hwnd, WM_CLOSE, 0, IntPtr.Zero);
  </code></pre>