locked
How to Add a menu element to a context menu of a visual studio built in item RRS feed

  • Question

  • Hi

    I wrote a programm that does some extra staff for a tier program. The program is dealing with data sets and is working well separately. So what I want when a user adds a given dataset as an item to the project explorer then when he or she right clicks the dataset and the context menu appears an additional element that I suppose to add that executes my piece of code appears in the context menu, then when the user clicks it the code will be executed on that dataset

    Thank you 

    Monday, June 13, 2011 8:53 AM

Answers

  • You add VSCT authoring to your package that adds a new command + a placement of that command on the target context menu, then you handle the QueryStatus and Exec requests for said command.  You also likely would need to use the IVsMonitorSelection to get the selected hierarchy item at the time the command was invoked.

    Ryan

    Monday, June 13, 2011 5:47 PM

All replies

  • You add VSCT authoring to your package that adds a new command + a placement of that command on the target context menu, then you handle the QueryStatus and Exec requests for said command.  You also likely would need to use the IVsMonitorSelection to get the selected hierarchy item at the time the command was invoked.

    Ryan

    Monday, June 13, 2011 5:47 PM
  • Hi Rayan

    I would to thank you, the fact that you answered me. But just bear with me as I'm novice in term of VS extensibility. would you mind to point me to some walkthougths in the context extending VS by adding a menu item to the context menu of a given VS item.

     

    Thank you again



    Wednesday, June 15, 2011 12:11 PM
  • Are you creating an add-in or a package? The answer is quite different.
    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com. My blog about developing add-ins: http://msmvps.com/blogs/carlosq/
    Wednesday, June 15, 2011 9:19 PM
  • Hi Carlos

    An add in is usually related to Office like excel or Outlook. What I'm focusing on is to add a package. Once that package is installed then a new item is exactly added to the context menu of the dataset item so that if the VS user right click any added data set item to the project explorer he or she will remark the presence of a new item. Once the user clicks that new added element then some logics are executed

    Tank you 


    Every one was a beginner once
    Monday, June 20, 2011 11:40 AM