title: How can I get an ITextBuffer out of an EnvDTE.Window?
body: <p>I have a managed syntax highlighter using the new VS extensibility API's and it gives me an <code>ITextBuffer</code>, which is great.</p>
  
  <p>In another part of my extension I am getting a DTE object and attaching to the active window changed event, which gives me an <code>EnvDTE.Window</code> object.</p>
  
  <pre><code>var dte = (EnvDTE.DTE)this.GetService(typeof(EnvDTE.DTE));
  dte.Events.WindowEvents.WindowActivated += WindowEvents_WindowActivated;
  // ...
  
  private void WindowEvents_WindowActivated(EnvDTE.Window GotFocus, EnvDTE.Window LostFocus)
  {
    // ???
    // Profit
  }
  </code></pre>
  
  <p>I would like to get the ITextBuffer out of Window in this method. Can anyone tell me a straight forward way to do that?</p>