Share via


IVsPackage.ResetDefaults(UInt32) Method

Definition

Resets Toolbox defaults.

public:
 int ResetDefaults(System::UInt32 grfFlags);
public:
 int ResetDefaults(unsigned int grfFlags);
int ResetDefaults(unsigned int grfFlags);
public int ResetDefaults (uint grfFlags);
abstract member ResetDefaults : uint32 -> int
Public Function ResetDefaults (grfFlags As UInteger) As Integer

Parameters

grfFlags
UInt32

[in] Flags whose values are taken from the __VSPKGRESETFLAGS enumeration.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsPackage::ResetDefaults(  
   [in] VSPKGRESETFLAGS grfFlags  
);  

Implement this method if you install items or tools, in the Toolbox. At setup, the environment loads your VSPackage, and calls its IVsPackage::ResetDefaults implementation. Once your VSPackage has successfully configured itself, the ResetDefaults method will not be called during subsequent setups, unless you later increment the Default Items key in the registry (found in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Packages\<Package GUID>\Toolbox]), or the user resets the Toolbox. If you increment the Default Items registry key, the ResetDefaults method is called with grfFlags set to PKGRF_TOOLBOXSETUP and if the Toolbox is reset, the ResetDefaults method is called with grfFlags set to PKGRF_TOOLBOXITEMS. For more information, see Registering Toolbox Item Providers.

The user can reset the Toolbox by selecting Toolbox from the View menu by right clicking in the Components section of the Toolbox, and selecting Add/Remove Items. This shows the Customize Toolbox dialog box, which includes the Reset button. Clicking the Reset button resets the Toolbox.

If you want the IVsPackage.ResetDefaults method to be called during setup only, you do not need to implement IVsToolboxDataProvider interface or specify a Formats registry key (found in [<VS Reg Root>\Packages\<Package GUID>\Toolbox]). For more information, see How to: Include Toolbox Support and IVsToolboxDataProvider Interface. When your IVsPackage::ResetDefaults implementation is called with a value of PKGRF_ADDSTDPREVIEWER in the grfFlags parameter, call AddStandardPreviewer at that time to populate the Browse With dialog box with a specific browser. For example, you can use this approach to provide a special emulator for your product.

Applies to