title: Global Windows Key Press
body: <p>I have a simple WPF application and I need to capture F1 key pressed in Windows (Operation System), even if my WPF window is minimized, or it isn't activated.</p>
  
  <p>I have problems with detecting this. I searched on Internet and I found many results, but they didn't helped me.</p>
  
  <p>For detecting a key pressed inside of application I used this simple code:</p>
  
  <pre><code>AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)KeyPressed);
  private void KeyPressed(object sender, KeyEventArgs e)
  {
        if (e.Key == Key.F1)
        {
             //my code went here
        }
  }
  </code></pre>
  
  <p>But this doesn't work when my window isn't activated.</p>
  
  <p>So, my question is: <strong>how to detect global key press?</strong></p>
  
  <p>I repeat: It is a WPF application.</p>