Example #1
0
        public bool TranslateAccelerator(ref MSG msg)
        {
            var message = new Message
            {
                hwnd    = msg.hwnd,
                message = (int)msg.message,
                wParam  = msg.wParam,
                lParam  = msg.lParam,
                time    = (int)msg.time,
                pt_x    = msg.pt.x,
                pt_y    = msg.pt.y
            };

            var used = ComponentDispatcher.RaiseThreadMessage(ref message);

            if (used)
            {
                msg.message = (uint)message.message;
                msg.wParam  = message.wParam;
                msg.lParam  = message.lParam;

                return(true);
            }

            return(false);
        }
Example #2
0
        public override bool PreProcessMessage(ref Message msg)
        {
            if (msg.Msg >= _wm_KEYFIRST && msg.Msg <= _wm_KEYLAST)
            {
                IVsFilterKeys2 filterKeys = (IVsFilterKeys2)ServiceProvider.GlobalProvider.GetService(typeof(SVsFilterKeys));
                Microsoft.VisualStudio.OLE.Interop.MSG oleMSG = new Microsoft.VisualStudio.OLE.Interop.MSG()
                {
                    hwnd = msg.HWnd, lParam = msg.LParam, wParam = msg.WParam, message = (uint)msg.Msg
                };

                //Ask the shell to do the command mapping for us and without firing off the command. We need to check if this command is one of the
                //supported commands first before actually firing the command.
                filterKeys.TranslateAcceleratorEx(new Microsoft.VisualStudio.OLE.Interop.MSG[] { oleMSG },
                                                  (uint)(__VSTRANSACCELEXFLAGS.VSTAEXF_NoFireCommand | __VSTRANSACCELEXFLAGS.VSTAEXF_UseGlobalKBScope | __VSTRANSACCELEXFLAGS.VSTAEXF_AllowModalState),
                                                  0 /*scope count*/,
                                                  new Guid[0] /*scopes*/,
                                                  out Guid cmdGuid,
                                                  out uint cmdId,
                                                  out int fTranslated,
                                                  out int fStartsMultiKeyChord);

                if (ShouldRouteCommandBackToVS(cmdGuid, cmdId, fTranslated == 1, fStartsMultiKeyChord == 1))
                {
                    return(false);
                }
            }

            return(base.PreProcessMessage(ref msg));
        }
Example #3
0
 internal static extern int DispatchMessage([In] ref Microsoft.VisualStudio.OLE.Interop.MSG msg);
Example #4
0
 internal static extern bool TranslateMessage([In, Out] ref Microsoft.VisualStudio.OLE.Interop.MSG msg);
Example #5
0
 internal static extern bool PeekMessage([In, Out] ref Microsoft.VisualStudio.OLE.Interop.MSG msg, HandleRef hwnd, int msgMin, int msgMax, int remove);