title: count any keystrokes whether or not Window (App) is in focus - WPF
body: <p>I'm building a "WPF Application" which is made to be run in the background (minimised state) and detects KeyStrokes of each and Every key on the keyboard  &amp;  every Mouse Clicks.</p>
  
  <p><strong>So, my question is how to detect every keyStrokes whether app (Window) is minimised or not.</strong></p>
  
  <p>Simply, if my app is in focus then i use this code to count keystrokes.</p>
  
  <pre><code>Public int count;
  protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)
  {
      //base.OnKeyDown(e);
      count++;
      tBlockCount.Text = count.ToString();
  }
  </code></pre>
  
  <p>I just want to do the same even if my app is minimised.</p>
  
  <p>I've searched a lot and come across many suggestions like..</p>
  
  <ul>
  <li><a href="http://www.pinvoke.net/default.aspx/user32/registerhotkey.html" rel="nofollow noreferrer">http://www.pinvoke.net/default.aspx/user32/registerhotkey.html</a></li>
  <li><a href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/87d66b1c-330c-42fe-8a40-81f82012575c/background-hotkeys-wpf?forum=wpf" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/vstudio/en-US/87d66b1c-330c-42fe-8a40-81f82012575c/background-hotkeys-wpf?forum=wpf</a></li>
  <li><a href="https://stackoverflow.com/questions/4795786/detecting-input-keystroke-during-wpf-processing">Detecting input keystroke during WPF processing</a></li>
  <li><a href="https://stackoverflow.com/questions/1752494/detect-if-any-key-is-pressed-in-c-sharp-not-a-b-but-any">Detect if any key is pressed in C# (not A, B, but any)</a></li>
  </ul>
  
  <p>Most of those are indicating towards Registering HotKeys. But I'm unable to match scenario with mine.</p>
  
  <p>Any kind of suggestion are most welcome.</p>