Exemplo n.º 1
0
        protected override void WndProc(ref Message m)
        {
            if (this.View == View.Details && columnHeaderContextMenu != null &&
                (int)m.Msg == (int)ShellAPI.WM.CONTEXTMENU)
            {
                if (suspendHeaderContextMenu)
                {
                    suspendHeaderContextMenu = false;
                }
                else
                {
                    int   x           = (int)ShellHelper.LoWord(m.LParam);
                    int   y           = (int)ShellHelper.HiWord(m.LParam);
                    Point clientPoint = PointToClient(new Point(x, y));

                    if (clientPoint.Y <= columnHeight)
                    {
                        columnHeaderContextMenu.Show(this, clientPoint);
                    }
                }

                return;
            }

            base.WndProc(ref m);
        }
        /// <summary>
        /// This method receives WindowMessages. It will make the "Open With" and "Send To" work
        /// by calling HandleMenuMsg and HandleMenuMsg2. It will also call the OnContextMenuMouseHover
        /// method of Browser when hovering over a ContextMenu item.
        /// </summary>
        /// <param name="m">the Message of the Browser's WndProc</param>
        /// <returns>true if the message has been handled, false otherwise</returns>
        protected override void WndProc(ref Message m)
        {
            #region IContextMenu

            if (_oContextMenu != null &&
                m.Msg == (int)WM.MENUSELECT &&
                ((int)ShellHelper.HiWord(m.WParam) & (int)MFT.SEPARATOR) == 0 &&
                ((int)ShellHelper.HiWord(m.WParam) & (int)MFT.POPUP) == 0)
            {
                string info = string.Empty;

                if (ShellHelper.LoWord(m.WParam) == (int)CMD_CUSTOM.ExpandCollapse)
                {
                    info = "Expands or collapses the current selected item";
                }
                else
                {
                    info = "";/* ContextMenuHelper.GetCommandString(
                               * _oContextMenu,
                               * ShellHelper.LoWord(m.WParam) - CMD_FIRST,
                               * false);*/
                }

                //br.OnContextMenuMouseHover(new ContextMenuMouseHoverEventArgs(info.ToString()));
            }

            #endregion

            #region IContextMenu2

            if (_oContextMenu2 != null &&
                (m.Msg == (int)WM.INITMENUPOPUP ||
                 m.Msg == (int)WM.MEASUREITEM ||
                 m.Msg == (int)WM.DRAWITEM))
            {
                if (_oContextMenu2.HandleMenuMsg(
                        (uint)m.Msg, m.WParam, m.LParam) == S_OK)
                {
                    return;
                }
            }

            #endregion

            #region IContextMenu3

            if (_oContextMenu3 != null &&
                m.Msg == (int)WM.MENUCHAR)
            {
                if (_oContextMenu3.HandleMenuMsg2(
                        (uint)m.Msg, m.WParam, m.LParam, IntPtr.Zero) == S_OK)
                {
                    return;
                }
            }

            #endregion

            base.WndProc(ref m);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method receives WindowMessages. It will make the "Open With" and "Send To" work
        /// by calling HandleMenuMsg and HandleMenuMsg2. It will also call the OnContextMenuMouseHover
        /// method of Browser when hovering over a ContextMenu item.
        /// </summary>
        /// <param name="m">the Message of the Browser's WndProc.</param>
        protected override void WndProc(ref Message m)
        {
            if (oContextMenu != null &&
                m.Msg == (int)WM.MENUSELECT &&
                ((int)ShellHelper.HiWord(m.WParam) & (int)MFT.SEPARATOR) == 0 &&
                ((int)ShellHelper.HiWord(m.WParam) & (int)MFT.POPUP) == 0)
            {
            }

            if (oContextMenu2 != null &&
                (m.Msg == (int)WM.INITMENUPOPUP ||
                 m.Msg == (int)WM.MEASUREITEM ||
                 m.Msg == (int)WM.DRAWITEM))
            {
                if (oContextMenu2.HandleMenuMsg(
                        (uint)m.Msg, m.WParam, m.LParam) == ResultOK)
                {
                    return;
                }
            }

            if (oContextMenu3 != null &&
                m.Msg == (int)WM.MENUCHAR)
            {
                if (oContextMenu3.HandleMenuMsg2(
                        (uint)m.Msg, m.WParam, m.LParam, IntPtr.Zero) == ResultOK)
                {
                    return;
                }
            }

            base.WndProc(ref m);
        }
        protected override void WndProc(ref Message m)
        {
            #region IContextMenu

            if (_iContextMenu != null &&
                m.Msg == (int)ShellAPI.WM.MENUSELECT &&
                ((int)ShellHelper.HiWord(m.WParam) & (int)ShellAPI.MFT.SEPARATOR) == 0)
            //&&
            //((int)ShellHelper.HiWord(m.WParam) & (int)ShellAPI.MFT.POPUP) == 0)
            {
                uint   cmdID = ShellHelper.LoWord(m.WParam);
                string info = null, command = null;
                if (cmdID == 0)
                {
                    return;
                }
                else
                if (cmdID > ShellAPI.CMD_LAST)
                {
                    info = command = removeCheckedSymbol(queryMenuItemsEventArgs.ExtraMenuItems[cmdID - ShellAPI.CMD_LAST - 1]);
                }
                else
                {
                    info = ContextMenuHelper.GetCommandString(
                        _iContextMenu, cmdID - ShellAPI.CMD_FIRST,
                        false);
                    command = ContextMenuHelper.GetCommandString(
                        _iContextMenu, cmdID - ShellAPI.CMD_FIRST,
                        true);
                }
                if (OnMouseHover != null)
                {
                    OnMouseHover(this, new MouseHoverEventArgs(command, info.ToString(), cmdID));
                }
            }

            #endregion


            #region IContextMenu2

            if (_iContextMenu2 != null &&
                (m.Msg == (int)ShellAPI.WM.INITMENUPOPUP ||
                 m.Msg == (int)ShellAPI.WM.MEASUREITEM ||
                 m.Msg == (int)ShellAPI.WM.DRAWITEM))
            {
                if (_iContextMenu2.HandleMenuMsg(
                        (uint)m.Msg, m.WParam, m.LParam) == ShellAPI.S_OK)
                {
                    return;
                }
            }

            #endregion

            #region IContextMenu3

            if (_iContextMenu3 != null &&
                m.Msg == (int)ShellAPI.WM.MENUCHAR)
            {
                if (_iContextMenu3.HandleMenuMsg2(
                        (uint)m.Msg, m.WParam, m.LParam, IntPtr.Zero) == ShellAPI.S_OK)
                {
                    return;
                }
            }

            #endregion

            base.WndProc(ref m);
        }