title: C# Detecting a Click in WndProc and calling a function after click happened
body: <p>I am trying to detect a <strong>click</strong> and preform calling a function only after the click actually happened.</p>
  
  <pre><code>[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
  protected override void WndProc(ref Message m) {
      //Detect a Click
      if (m.Msg == 0x210 &amp;&amp; m.WParam.ToInt32() == 513){
          lastClick = DateTime.Now;
          clickedHappened();
          Debug.Print("Click Detected!");
      }
  
      base.WndProc(ref m);
  
  }
  
  private void clickedHappened(){
      MessageBox.Show("Click Already Happened");
  }
  </code></pre>
  
  <p>I think that <strong>WndProc</strong> happens way before the actual click takes place.<br>
  I was wondering if there was a way to solve this with out using a <strong>timer</strong>?  or <code>sleep(400)</code>;</p>
  
  <p>The only solution I can come up with is using a <strong>timer</strong>, but I want to get rid of some of my existing timers.  It seems that the click actually happens 200 - 350 ms after it was detected in <strong>WndProc</strong>.</p>