title: How do I determine number of window handles an application is using?
body: <p>What is the best way to determine how many window handles an application is using?  Is there a tool or a WMI performance counter that I could use?</p>
  
  <p>I would like to run up an app and watch a counter of some sort and see that the number of window handles is increasing. </p>
  
  <pre><code>for (int i=0; i &lt; 1000; i++)
  {
      System.Threading.Thread.Sleep(1000);
      RichTextBox rt = new RichTextBox();
      rt.Text = "hi";
      this.Controls.Add(rt);
  }
  </code></pre>
  
  <p>I am running the above code and watching the "Handle Count" counter on the process, and it does not seem to be increasing.  Is there something I am looking at incorrectly?</p>