locked
How to open a Custom Options Page RRS feed

  • Question

  • First of all, I would like to say sorry for my bad English, I’m not used to talk or write in English and sometimes is difficult for me to find the correct words.

     

    I have made an Add-In for Visual Studio 2005 in C#. I have included a control in it to make a Custom Options Page following this method:

     

    http://msdn.microsoft.com/en-us/library/b389wd38.aspx

     

    I use:

     

    EnvDTE.DTE dte = (EnvDTE.DTE)Connect.applicationObject;

                            dte.ExecuteCommand("Tools.Options", "");

     

    to open the page. I know I must use the GUID of the page as the second parameter to open it.

     

    I know how to create a GUID using:  Tools --> Create GUID --> Registry format

     

    I know how to create a Registry entry with that GUID using this method:

     

                    RegistryKey key1 = Registry.LocalMachine.CreateSubKey(“SOFTWARE\\Microsoft\\VisualStudio\\8.0\\ToolsOptionsPages\\<Options_Node_Name>”);

    RegistryKey key2 = Registry.LocalMachine.CreateSubKey(“SOFTWARE\\Microsoft\\VisualStudio\\8.0\\ToolsOptionsPages\\<Options_Node_Name>\\<Options_Page >”);

    Key2.SetValue(“Default”, “XXX”);

    Key2.SetValue(“Page”, <GUID>);

     

    <Options_Node_Name> is the name that appears in the .Add-In file in the <Category> tag

    <Options_Page> is the name that appears in the .Add-In file in the <SubCategory> tag

     

    But I don’t know if I can use whatever “XXX” I want. And I don’t know how to make that the registry key I have made points to the Custom Options Page I made.

     

    I mean:

     

    I make the registry key with the Name of the Node and the name of the Page (Category and SubCategory)  I make the Default value (with an invented number) and the Page value (with the GUID I made in Tools --> Create GUID) but when when I try to use that GUID to open the page it doesn’t work.

     

    Could you please give me some help??

     

    Thank you very much.

     

    Best regards.

     

    David García.

    • Moved by CoolDadTx Tuesday, August 31, 2010 5:12 PM Extensibility related (From:Visual C# IDE)
    Tuesday, August 31, 2010 3:47 PM

Answers

  • Hi David,

     

    Thanks for your post.

    I suppose you'd like to open the options window programmatically,

    if so, I don't think the second GUID parameter is necessary, could you please just try:

    dte.ExecuteCommand("Tools.Options");

    I've tried it and it works fine.

    Hope this can help.

     

    Best Regards,

    Ziwei Chen

    • Marked as answer by Victor_Chen Monday, September 6, 2010 1:46 AM
    Thursday, September 2, 2010 6:39 AM