Condividi tramite


Creating Tools Options Pages with Interop Assemblies

Managed VSPackages can use the COM-based interop assemblies of the Visual Studio SDK to extend the Visual Studio integrated development environment (IDE) by adding Options pages to the Tools menu.

A Tools Options page is fundamentally a user control, and is coded in the same way as any other user control. Typically, you would use one of the Visual Studio IDE's designers to create the object and add user controls.

Nota

A Tools Options page implemented as a dialog box, using a DialogProc to handle windows messages, must be a modeless dialog box, and must not call the EndDialog function.

You should use the automation object that the VSPackage provides to the environment to support the properties that the user control displays.

A VSPackage that implements a Tools Options page can support programmatic control of its properties directly or through the IDE's automation model. For more information on supporting Tools Options pages with automation, see Creating Tools Options Pages with Automation.

Additional information on how to implement a Tools Options page can be found in the Options Package Sample (C++).

Making Tools Options Pages Available to the IDE

In addition to implementing a user control, VSPackages must make that control available to the IDE.

This is done through the implementation of the GetPropertyPage method, which returns a VSPROPSHEETPAGE structure based on the GUID passed.

The IDE uses the VSPROPSHEETPAGE structure to set the characteristics of a Properties page.

The settings contained in its dwFlags member determine the exact interpretation of the other members of VSPROPSHEETPAGE. The structure typically provides:

  • A handle to the instance from which to load an icon or string resource.

  • The resource identifier of the page's dialog box templates.

  • A pointer to the DialogProc for the page.

For more information, see the Options Package Sample (C++).

Registering a Tools Options Page

You can register a Tools Options page by creating an entry in the following registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<Version>\ToolsOptionsPages, where <Version> is the version of Visual Studio, such as 8.0.

To register the page, you can either manually edit the registry or use a registry script (.rgs file). For more information, see Creating Registrar Scripts.

See Also

Concepts

Extending the Visual Studio Environment

Creating Registrar Scripts

Automation Support for Tools Options Pages

Using Tools Options Pages

Creating Tools Options Pages with Managed Package Framework Classes

Creating Tools Options Pages with Automation

DialogProc