title: Enumerate browser tabs from external application
body: <p>A bit of an odd (challenging?) question. Is it possible to programmatically access the tabs of an open browser from a external application? I realize that's a vague question, but hear me out:</p>
  
  <p>What I'm trying to create is a "Gmail Chat Notifier" application that flashes a notification icon in the Windows system tray when an unanswered chat message exists. Right now, as far as I can tell, the only built-in Gmail chat notifications are:</p>
  
  <ol>
  <li>Enable sounds (which I don't prefer)</li>
  <li>Watch the window/tab/page title for the alternating flashing "Gmail" / "Blah says..." message.</li>
  </ol>
  
  <p>The problem with #2 is: When the browser window is minimized, and when the Gmail tab isn't the <strong>active</strong> tab in the browser, the window title doesn't change and I don't notice new chat messages.</p>
  
  <p>So I'd like to create an application that watches the tab titles for me. (All of the tab titles, not just the window title, which is only the active tab title.) I created a proof-of-concept C# application to detect unanswered chat messages by enumerating the active Windows processes and watching for the flashing "Blah says..." in the window title:</p>
  
  <pre><code>Process[] procs = Process.GetProcesses();
  IntPtr hWnd;
  foreach (Process proc in procs)
      if ((hWnd = proc.MainWindowHandle) != IntPtr.Zero)
          if (proc.MainWindowTitle.IndexOf(" says… ") &gt;= 0)
          ...
  </code></pre>
  
  <p>But the obvious problem with this is that it won't work when the Gmail tab isn't the active/focused tab (since it only looks at window titles). So I need something that can dig deeper and look at the tab titles.</p>
  
  <p>I'm open to anything. What I had been thinking <em>might</em> work is finding a way to enumerate the browser's tabs somehow (MDI child windows? * fingers crossed *), but maybe that's not even close to possible :) I'm also open to other solutions too if there's a way to do this with, say, Firefox plugins or something (but it'd be nice to integrate with the Windows system tray, and not just exist in the browser sandbox).</p>
  
  <p>Can anyone help get me started? Thanks much in advance.</p>