2

I want to use global hotkeys (one that works outside of the app) and i found this

It looks like i need to initialize it using a System.Windows.Window. But how do i get one?

Community
  • 1
  • 1

1 Answers1

2

System.Windows.Window is a WPF Window.

If you are doing this with Windows Forms or no form, you can setup a low-level keyboard hook, and trap your hotkey that way.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • Please don't do this. Keyboard hooks are a fairly unfriendly way to solve a problem for which windows already has a solution. – John Knoeller Feb 02 '10 at 02:27
  • Keyboard hooks are the only real way to handle this for supporting hotkeys that work "outside of the app", which the OP requested. The other solutions require a window handle, typically, which means a form needs to exist, and most only work if the application is active. – Reed Copsey Feb 02 '10 at 02:34
  • OMG sorry, i accidentally clicked down instead of up. I couldnt change it until i edit your answer. So i edit some whitespace. +1 –  Feb 02 '10 at 17:01