tags:

views:

803

answers:

0

I'm trying to send input from a WPF Window which doesn't have focus. The idea is to create a virtual numpad, whereby pressing Alt+M for example sends Alt+Numpad0. I've got Michael Kennedy's global hooks working, but I can't find a way to: 1) Send keys from an inactive window 2) Swallow these keys so they're not processed by the application which has focus.

The second may become a non-issue once I get the first fixed.

System.Windows.Forms.SendKeys didn't work for this because I need to simulate the Alt+xxx combinations to generate the right characters. I also tried System.Windows.Input.InputManager.Process() from an MSDN post, but if the Window sending the input doesn't have focus, the InputSource I was using (second parameter - Keyboard.PrimaryDevice.ActiveSource) is null.

Any ideas?

Why a virtual numpad? Without a numpad on my laptop (Studio 1555) I can't enter symbols without opening charmap - thanks Dell!