Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8657619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:34:00+00:00 2026-06-12T15:34:00+00:00

How to add my right click menus in SSMS 2008R2\2012 Object Explorer? I researched

  • 0

How to add my right click menus in SSMS 2008R2\2012 Object Explorer?
I researched this topic.

I do this way:

private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {            
            INodeInformation[] nodes;
            int nodeCount;

            objectExplorer.GetSelectedNodes(out nodeCount, out nodes);
            INodeInformation node = (nodeCount > 0 ? nodes[0] : null);

            if (_databaseMenu == null &&
                _databaseRegex.IsMatch(node.Context))
            {
                _databaseMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
                _databaseMenu.AddChild(string.Empty, new MenuItem());
            }            
        }

BUT the problem is: if I do left click on database and then right click – I see my menu, ok. If I expand the object tree via (+) and then immediately right click on database – I do not see my menu.
I understand why it is but how to solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:34:01+00:00Added an answer on June 12, 2026 at 3:34 pm

    I spent a considerable amount of time working on this same issue for my own SSMS add-in. What I came up with is a dirty hack, but it was the only way I could find to get it working reliably.

    You use SendKeys.SendWait to issue SHIFT + F10, which is the shortcut to open the context menu, and you do it twice, since a single issuance will toggle the menu’s state (visible to not or vice versa). The UI will stop responding and eventually throw if you use Send, so be sure to use SendWait.

    There will be a slight delay on left click or flicker of the menu on right click. And, of course, this won’t work if the user has altered that shortcut (or has defined external, superseding macros), but a quick glance through the SSMS options doesn’t reveal any way to change the context menu shortcut.

        private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {            
            INodeInformation[] nodes;
            int nodeCount;
    
            objectExplorer.GetSelectedNodes(out nodeCount, out nodes);
            INodeInformation node = (nodeCount > 0 ? nodes[0] : null);
    
            if (_databaseMenu == null &&
                _databaseRegex.IsMatch(node.Context))
            {
                _databaseMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
                _databaseMenu.AddChild(string.Empty, new MenuItem());
                SendKeys.SendWait("+({F10})")
                SendKeys.SendWait("+({F10})")
            }            
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add right click menu items to the explorer (i.e. when you
on Windows Explorer, how do I add items on the Right-Click menu? I would
I'm using this code to add an item to the code window right click
I want to add a custom right-click menu to my web application. Can this
I would like to add a right click menu option to Windows explorer for
I would like to add a right click context menu/sub menus to my win32
How to add a right click context menu in Windows Explorer for all kind
I have a program that I add into explorer's right click menu. When I
I tried to add a menu item to package explorer's right click menu. But
I need to add a command to right click menu in Word shown after

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.