Well, perhaps, and it can really be useful if your application is deployed in an environment where the camera is not accessible to the user.
First of all, I used the RegisterHotKey and UnregisterHotKey API calls described here http://pinvoke.net/default.aspx/user32.RegisterHotKey , as described in this pretty old article here http://msdn.microsoft.com/en-us /magazine/cc163713.aspx .
I registered the IDHOT_SNAPDESKTOP in the IDHOT_SNAPDESKTOP event and did not register it in Window_Closed . Trying to do this in the constructor gave me problems getting a consistent handle using the WindowInteropHelper(this) method.
If you want to do more than just ignore the keys, you can customize the Windows message handler by pretending to use WndProc.
HwndSource source = HwndSource.FromHwnd(<handle>); source.AddHook(<WndProc>);
creating a descriptor as described above, and implementing WndProc yourself.
So far I do not know how to "not" process the hotkey and get windows for normal behavior, except, of course, unregistering the hot keys.
Its not very elegant or "WPF", but it worked for me.
Like @ghord comments
Using EnsureHandle() seems useful for getting a handler in a constructor.
Jodrell
source share