using System.Runtime.InteropServices;
using System.Windows.Forms;
[DllImport("User32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("User32.dll")]
private static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
static void Main(string[] args)
Application.AddMessageFilter(new KeyMessageFilter());
Application.KeyDown += new KeyEventHandler(KeyDownHandler);
private static void KeyDownHandler(object sender, KeyEventArgs e)