title: Capturing mouse events from every component
body: <p>I have a problem with MouseEvents on my WinForm C# application.</p>
  
  <p>I want to get <em>all</em> mouse clicks on my application, but I don't want to put a listener in every child component neither use Windows mouse hook.</p>
  
  <p>On Flash I could put a listener on Stage to get all the MouseEvents on the movie.</p>
  
  <p>Is there such thing on C#? A global MouseListener?</p>
  
  <hr>
  
  <p><strong>Edit:</strong></p>
  
  <p>I create this class from IMessageFilter ans used Application.AddMessageFilter.</p>
  
  <pre><code>public class GlobalMouseHandler : IMessageFilter{
  
      private const int WM_LBUTTONDOWN = 0x201;
  
      public bool PreFilterMessage(ref Message m){
          if (m.Msg == WM_LBUTTONDOWN) {
              // Do stuffs
          }
          return false;
      }
  }
  </code></pre>
  
  <p>And put this code on the Controls that need listen global clicks: </p>
  
  <pre><code>GlobalMouseHandler globalClick = new GlobalMouseHandler();
  Application.AddMessageFilter(globalClick);
  </code></pre>