/// <summary>
        /// Checks if the passed Windows Message is the KeyDown message and
        /// calls the callback function of the ActionKey.
        /// </summary>
        /// <param name="msg">The Windows Message to handle.</param>
        /// <returns>True if key was handled (In this case no other callback functions will be called).</returns>
        public bool HandleKeyMessage(ref Message msg)
        {
            if (msg.Msg != WM_KEYDOWN && msg.Msg != WM_KEYUP)
            {
                return(false);
            }

            VirtualKey          key        = VirtualKey.VK_CANCEL;
            KeyDownLParamHelper kdLPHelper = null;

            try
            {
                key        = (VirtualKey)msg.WParam.ToInt32();
                kdLPHelper = new KeyDownLParamHelper(msg.LParam.ToInt32());
            }
            catch (Exception)
            {
                return(false);
            }

            if (msg.Msg == WM_KEYDOWN)
            {
                CaptureControlKeysState(key, true, kdLPHelper.Extended);
            }

            if (msg.Msg == WM_KEYDOWN && mActionKeys.ContainsKey(key))
            {
                foreach (ActionKeyInfo actionKeyInfo in mActionKeys[key])
                {
                    actionKeyInfo.ControlKeysState = mControlKeysState;
                    if (actionKeyInfo.CallBack != null && actionKeyInfo.DoModifierKeysMatch() && (!actionKeyInfo.Once || !kdLPHelper.Prev))
                    {
                        if (actionKeyInfo.CallBack(actionKeyInfo))
                        {
                            return(true);
                        }
                    }
                }
            }
            else if (msg.Msg == WM_KEYUP)
            {
                CaptureControlKeysState(key, false, kdLPHelper.Extended);
            }

            return(false);
        }
        /// <summary>
        /// Checks if the passed Windows Message is the KeyDown message and
        /// calls the callback function of the ActionKey.
        /// </summary>
        /// <param name="msg">The Windows Message to handle.</param>
        /// <returns>True if key was handled (In this case no other callback functions will be called).</returns>
        public bool HandleKeyMessage(ref Message msg)
        {
            if (msg.Msg != WM_KEYDOWN && msg.Msg != WM_KEYUP)
                return false;

            VirtualKey key = VirtualKey.VK_CANCEL;
            KeyDownLParamHelper kdLPHelper = null;
            try
            {
                key = (VirtualKey)msg.WParam.ToInt32();
                kdLPHelper = new KeyDownLParamHelper(msg.LParam.ToInt32());
            }
            catch (Exception)
            {
                return false;
            }

            if (msg.Msg == WM_KEYDOWN)
                CaptureControlKeysState(key, true, kdLPHelper.Extended);

            if (msg.Msg == WM_KEYDOWN && mActionKeys.ContainsKey(key))
            {
                foreach (ActionKeyInfo actionKeyInfo in mActionKeys[key])
                {
                    actionKeyInfo.ControlKeysState = mControlKeysState;
                    if (actionKeyInfo.CallBack != null && actionKeyInfo.DoModifierKeysMatch() && (!actionKeyInfo.Once || !kdLPHelper.Prev))
                        if (actionKeyInfo.CallBack(actionKeyInfo))
                            return true;
                }
            }
            else if (msg.Msg == WM_KEYUP)
                CaptureControlKeysState(key, false, kdLPHelper.Extended);

            return false;
        }