title: Trying to use (System-Wide) Hotkeys in WPF/C#
body: <p>I've been trying to use System-Wide/Global HotKeys in my latest WPF/C# project. Lucky for me, I came upon this wonderful class, here - <a href="http://www.codeproject.com/Tips/274003/Global-Hotkeys-in-WPF" rel="nofollow">http://www.codeproject.com/Tips/274003/Global-Hotkeys-in-WPF</a>.</p>
  
  <p>The only problem is, <em>I can't get it to work</em>. I've been banging my head with this since last week, and the weird thing is, I'm getting no errors. Here's my code, any ideas why?</p>
  
  <pre><code>HotKey hotkey = new HotKey((System.Windows.Interop.HwndSource)System.Windows.Interop.HwndSource.FromVisual(App.Current.MainWindow));
                  //hotkey.Modifiers = list[i]._HotkeyA.Modifier; hotkey.Key = list[i]._HotkeyA._Key;
                  hotkey.Modifiers = HotKey.ModifierKeys.Shift; hotkey.Key = Key.F2;
                  hotkey.HotKeyPressed += new EventHandler&lt;HotKeyEventArgs&gt;(delegate(Object o, HotKeyEventArgs e)
                  {
                      Console.WriteLine("Congratulations, Cap'n.");
                      System.Windows.Forms.MessageBox.Show("YAAY HOTKEY HAZ BEEN TEH PRESSEDS!");
                  });
                  hotkey.Enabled = true;
  </code></pre>
  
  <p>Thanks in advance!</p>