Ejemplo n.º 1
0
        public override bool PreProcessMessage(ref Message msg)
        {
            NiMessage message = msg;
            PreProcessMessageResult preProcessMessageResult;
            bool processed = ErrorUtil.ThrowOnFailure(_client.PreProcessMessage(ref message, out preProcessMessageResult));

            msg = message;

            Stubs.ControlSetState2(
                this,
                Stubs.STATE2_INPUTKEY,
                (preProcessMessageResult & PreProcessMessageResult.IsInputKey) != 0
                );

            Stubs.ControlSetState2(
                this,
                Stubs.STATE2_INPUTCHAR,
                (preProcessMessageResult & PreProcessMessageResult.IsInputChar) != 0
                );

            return(processed);
        }
Ejemplo n.º 2
0
        int IIsolationClient.PreviewKeyDown(Keys keyData)
        {
            try
            {
                int result = 1;

                var target = FindTarget(NativeMethods.GetFocus());
                if (target != null)
                {
                    var e = new PreviewKeyDownEventArgs(keyData);

                    Stubs.ControlOnPreviewKeyDown(target, e);

                    result = e.IsInputKey ? 0 : 1;
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }