Ejemplo n.º 1
0
        HResult INiIsolationClient.PreProcessMessage(ref NiMessage message, out PreProcessMessageResult preProcessMessageResult)
        {
            preProcessMessageResult = 0;

            try
            {
                var result = HResult.False;

                var target = FindTarget(message.HWnd);
                if (target != null)
                {
                    Message msg = message;
                    result  = target.PreProcessMessage(ref msg) ? HResult.OK : HResult.False;
                    message = msg;

                    if (ControlStubs.ControlGetState2(target, ControlStubs.STATE2_INPUTKEY))
                    {
                        preProcessMessageResult |= PreProcessMessageResult.IsInputKey;
                    }
                    if (ControlStubs.ControlGetState2(target, ControlStubs.STATE2_INPUTCHAR))
                    {
                        preProcessMessageResult |= PreProcessMessageResult.IsInputChar;
                    }
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
Ejemplo n.º 2
0
        public HResult PreFilterMessage(ref NiMessage message)
        {
            try
            {
                if (_preMessageFilterRecursion > 0)
                {
                    return(HResult.False);
                }

                _preMessageFilterRecursion++;

                try
                {
                    return(MessageFilterUtil.InvokeMessageFilter(ref message)
                        ? HResult.OK
                        : HResult.False);
                }
                finally
                {
                    _preMessageFilterRecursion--;
                }
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
Ejemplo n.º 3
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (base.ProcessCmdKey(ref msg, keyData))
            {
                return(true);
            }

            NiMessage message = msg;
            bool      result  = ErrorUtil.ThrowOnFailure(_host.ProcessCmdKey(ref message, keyData));

            msg = message;

            return(result);
        }
Ejemplo n.º 4
0
        HResult INiIsolationHost.ProcessCmdKey(ref NiMessage message, Keys keyData)
        {
            try
            {
                Message msg    = message;
                bool    result = ProcessCmdKey(ref msg, keyData);
                message = msg;

                return(result ? HResult.OK : HResult.False);
            }
            catch (Exception ex)
            {
                return(ErrorUtil.GetHResult(ex));
            }
        }
Ejemplo n.º 5
0
        public static bool InvokeMessageFilter(ref NiMessage message)
        {
            // This methods invokes System.Windows.Forms.Application+ThreadContext.ProcessFilters.
            // The purpose of this is to broadcast pre-filter messages over
            // AppDomains. The idea is that every AppDomain has a mesage filter.
            // When this message filter receives a message, it is passed
            // to INiShell.BroadcastPreFilterMessage. That method invokes
            // this method on AppDomain 1 and passes it on to all INiPackages
            // that implement INiPreMessageFilter. That implementation in turn
            // also invokes this method so that the message is broadcasted to
            // the rest of the AppDomains. Care must be taken to make sure that
            // this does not recurse, so all calls to INiShell.BroadcastPreMessageFilter
            // and MessageFilterUtil.InvokeMessageFilter must be protected with
            // recursion prevention.

            return(_invokeMessageFilterDelegate(ref message));
        }
Ejemplo n.º 6
0
            public HResult PreProcessMessage(ref NiMessage message, out PreProcessMessageResult preProcessMessageResult)
            {
                preProcessMessageResult = 0;

                try
                {
                    if (_page != null)
                    {
                        return(_page.PreProcessMessage(ref message, out preProcessMessageResult));
                    }

                    return(HResult.False);
                }
                catch (Exception ex)
                {
                    return(ErrorUtil.GetHResult(ex));
                }
            }
Ejemplo n.º 7
0
        public override bool PreProcessMessage(ref Message msg)
        {
            NiMessage message = msg;
            PreProcessMessageResult preProcessMessageResult;
            bool processed = ErrorUtil.ThrowOnFailure(_window.PreProcessMessage(ref message, out preProcessMessageResult));

            msg = message;

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

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

            return(processed);
        }
Ejemplo n.º 8
0
            public bool PreFilterMessage(ref Message m)
            {
                if (_package._preMessageFilterRecursion > 0)
                {
                    return(false);
                }

                _package._preMessageFilterRecursion++;

                try
                {
                    InstallListViewListener(ref m);

                    NiMessage message   = m;
                    bool      processed = ErrorUtil.ThrowOnFailure(_shell.BroadcastPreMessageFilter(ref message));
                    m = message;

                    return(processed);
                }
                finally
                {
                    _package._preMessageFilterRecursion--;
                }
            }