Creating Custom Tools/Options Pages
The Options dialog box on the Tools menu displays a variety of option pages for different parts of Visual Studio .NET. You can control the existing options pages, as outlined in Controlling Tools Options Settings, and you can also add your own custom Options pages. Many Add-ins require a way to display a user interface for configuring the Add-in, and a custom Options page allows you to do this in a way that is seamlessly integrated into the Visual Studio .NET integrated development environment (IDE).
A custom Options page is an ActiveX control with a UI that implements the IDTToolsOptionsPage interface and is registered with Visual Studio .NET. Custom options pages created in Visual C++ .NET must be ATL controls. The control added to the options page can be implemented in the same DLL as the Add-in, or in a separate DLL. Once these criteria are met, the ActiveX control appears as a new page in the Options dialog box.
To create an Options page with a .NET Windows Form using Visual Basic .NET or Visual C# .NET, in addition to implementing the IDTToolsOptionsPage interface, you must implement a shim control in Visual C++ .NET to enable the custom page to display. Microsoft has a Visual C++ .NET sample available for download on the Visual Studio .NET Automation Samples website that demonstrates how to implement a custom Options page. See the RegExplore sample at http://msdn.microsoft.com/vstudio/downloads/automation.asp.
Options Page Registration
To make a custom page available in the Options dialog box, certain registry keys must be added. This is done under the key:
HKLM (or HKCU)
Note (HKLM|HKCU)\SOFTWARE\Microsoft\VisualStudio\7.0 is not the correct key for every situation. For example, if you are running VSE, the key might be (HKLM|HKCU)\SOFTWARE\Microsoft\VSE\7.0. You can use GetRegistryRoot to determine the root of the registry.
In this point in the registry, you mimic the structure that you want to display in the left pane of the Options dialog. For example, to create an entry for the J/Direct call builder, you would use the key:
J/Direct Call Builder
The strings used for the key names are in US English (LOCALE 0x409) so that an Add-in or macro can use the Properties property to access the options. To support localizing the text in your custom page, the IDE looks for the following values both under the category name key (for example, Wizards) and the subcategory name key (for example, J/Direct Call Builder):
Only two levels of keys are permitted. For example, you can add a category "Wizard" and a subcategory "SubWiz", but you cannot add "Key3" under "SubWiz." There is one exception, however. If the first key under "Options" is "Text Editor," then you can add two more levels. For example, you can specify "Java" under "Text Editor" and then "MyAddin" under "Java."
At the last level (for example, under "J/Direct Call Builder"), you must specify a value for the control that is the UI for your custom Options page. This value holds the GUID or ProgID of the control and must have the name "Control."
If a SatelliteDllPath is not specified, then the same rule for resolving its path is the same as that used for resolving the path of an Add-in. You should supply the path to improve performance.
Controlling Projects and Solutions | Adding and Handling Commands | Creating and Controlling Environment Windows | Creating Add-Ins and Wizards | Creating an Add-In | Creating a Wizard | Automation and Extensibility Reference | Automation Object Model Chart