MouseKeyboardActivityMonitor.KeyboardHookListener.ProcessCallback C# (CSharp) Method

ProcessCallback() protected method

This method processes the data from the hook and initiates event firing.
protected ProcessCallback ( int wParam, IntPtr lParam ) : bool
wParam int The first Windows Messages parameter.
lParam System.IntPtr The second Windows Messages parameter.
return bool
        protected override bool ProcessCallback(int wParam, IntPtr lParam)
        {
            KeyEventArgsExt e = KeyEventArgsExt.FromRawData(wParam, lParam, IsGlobal);

            // not allow
            Keys[] notAllowedKeys = {  Keys.LControlKey, Keys.RControlKey, Keys.LMenu, Keys.RMenu, Keys.LWin, Keys.RWin, Keys.Apps, Keys.Alt, Keys.Control, Keys.Tab, Keys.F1, Keys.F2, Keys.F3, Keys.F4, Keys.F5, Keys.F6, Keys.F7, Keys.F8, Keys.F9, Keys.F10, Keys.F11, Keys.F12 };

            Console.WriteLine(" * Oh! : " + e.KeyData);

            if ((Array.IndexOf(notAllowedKeys, e.KeyData) != -1) || e.Control || e.Alt || (e.Shift && e.Alt))
            {
                Console.WriteLine(" * Block1 : " + e.KeyData);
                return e.Handled;
            }
            else if (e.KeyData.ToString() == "Tab, Shift" || e.KeyData.ToString() == "Shift, Tab")
            {
                // not allow modifier with tab!
                Console.WriteLine(" * Block2 : " + e.KeyData);
                return e.Handled;
            }
            else
            {
                // for debug purpose
                string st = e.KeyData.ToString();
                string[] s = st.Split(',');
                Console.WriteLine("st:" + st);
                Console.WriteLine("s:" + s.Length);

                foreach (var keyData in s)
                {
                    Console.WriteLine(" * keyData : [" + keyData + "]");
                }

                // allow
                InvokeKeyDown(e);
                InvokeKeyPress(wParam, lParam);
                InvokeKeyUp(e);
                return !e.Handled;
            }
        }