Freigeben über


IVsPackage.ResetDefaults Method

Resets Toolbox defaults.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function ResetDefaults ( _
    grfFlags As UInteger _
) As Integer
int ResetDefaults(
    uint grfFlags
)
int ResetDefaults(
    [InAttribute] unsigned int grfFlags
)
abstract ResetDefaults : 
        grfFlags:uint32 -> int
function ResetDefaults(
    grfFlags : uint
) : int

Parameters

  • grfFlags
    Type: UInt32

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

Return Value

Type: Int32
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.

.NET Framework Security

See Also

Reference

IVsPackage Interface

Microsoft.VisualStudio.Shell.Interop Namespace