IVsUserSettingsQuery Interface

Definition

Allows a VSPackage to indicate if its settings need to be saved or not.

public interface class IVsUserSettingsQuery
public interface class IVsUserSettingsQuery
__interface IVsUserSettingsQuery
[System.Runtime.InteropServices.Guid("334E1F15-7D97-4231-81B0-998E4A960E69")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsUserSettingsQuery
[<System.Runtime.InteropServices.Guid("334E1F15-7D97-4231-81B0-998E4A960E69")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsUserSettingsQuery = interface
Public Interface IVsUserSettingsQuery
Derived
Attributes

Examples

STDMETHOD(NeedExport)(WCHAR* pszCategoryGUID, BOOL *pfNeedExport)  
{  
    if (!pfNeedExport)  
        return E_INVALIDARG;  

    CLSID clsidCategory;  
    HRESULT hr= S_OK;  

    hr = CLSIDFromString(pszCategoryGUID, &clsidCategory);  
    IfFailGo(hr);  
    if (GUID_Profiles_CommandBars == clsidCategory) {  
        *pfNeedExport = TRUE; //Always export Command Bar Configuration  
    }else if (GUID_Profiles_KeyBindings == clsidCategory) {  
        *pfNeedExport = FALSE; //By Default don't export key bindings  
        if (m_fMake_Permanent)  
            *pfNeedExport = TRUE; //Export if user wants current configuration saved.  
    }else{  
        hr = E_UNEXPECTED;  
    }  
 Error:  
    return hr;  
}  

Remarks

Notes for Implementers

Implement if a VSPackage needs to control its settings being saved to a Visual Studio settings file.

Notes for Callers

This interface should only be implemented if a VSPackage needs to control the savings of its settings.

For instance, a VSPackage may allow users to change settings for the current session, but only update stored information when they click a Save button.

If a VSPackage does not implement this interface, its state is always exported.

A single VSPackage can support more than one Custom Settings Point (settings category). Therefore, implementations of NeedExport must check the supplied Custom Settings Point's identifying GUID or settings category argument, to determine if a particular group of settings needs to be saved.

For instance, in the example below, the VSPackage always requests that its command bar state is saved, but only requests its key binding state be saved if a flag has been set.

Methods

NeedExport(String, Int32)

Indicates whether the specified category requires an export of its settings.

Applies to