How can I change the entered key through keyboard outside my application in C#?
<p>I am trying to change the entered key by keyboard.</p>

<p>I have managed to restrict key entered by keyboard.</p>

<p><strong>Code in C#:</strong></p>

<pre><code>    using System.Runtime.InteropServices;

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            SetWindowsHookEx(WH_KEYBOARD_LL, hookProc, LoadLibrary("User32"), 0);
            HookedKeys.Add(Keys.A);
            HookedKeys.Add(Keys.B);
        }

        [DllImport("user32.dll")]
        static extern IntPtr SetWindowsHookEx(int idHook, keyboardHookProc callback, IntPtr hInstance, uint threadId);

        [DllImport("kernel32.dll")]
        static extern IntPtr LoadLibrary(string lpFileName);

        const int WH_KEYBOARD_LL = 13;
        const int WM_KEYDOWN = 0x100;

        public List&lt;Keys&gt; HookedKeys = new List&lt;Keys&gt;();

        public delegate int keyboardHookProc(int code, int wParam, ref keyboardHookStruct lParam);
        public struct keyboardHookStruct
        {
            public int vkCode;
        }

        public int hookProc(int code, int wParam, ref keyboardHookStruct lParam)
        {
            Keys key = (Keys)lParam.vkCode;
            if (HookedKeys.Contains(key))
                return 1;
            else
                return 0;
        }

    }
</code></pre>

<p>After debugging check on Notepad or anywhere else in window....
A and B key will not work</p>

<p><strong>How can I modify the keys, in place of 'A' some other key?</strong></p>
