Export (0) Print
Expand All

IVsUserSettingsQuery Interface

Allows a VSPackage to indicate whether its settings should be saved or not.

Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop.8.0 (in microsoft.visualstudio.shell.interop.8.0.dll)

[GuidAttribute("334E1F15-7D97-4231-81B0-998E4A960E69")] 
[InterfaceTypeAttribute(1)] 
public interface IVsUserSettingsQuery
/** @attribute GuidAttribute("334E1F15-7D97-4231-81B0-998E4A960E69") */ 
/** @attribute InterfaceTypeAttribute(1) */ 
public interface IVsUserSettingsQuery
GuidAttribute("334E1F15-7D97-4231-81B0-998E4A960E69") 
InterfaceTypeAttribute(1) 
public interface IVsUserSettingsQuery

Notes for Implementers

Implement if a VSPackage must control whether its settings are saved to a Visual Studio settings file.

Notes for Callers

This interface should be implemented only if a VSPackage must control whether its settings are saved. For instance, a VSPackage may let a user change settings for the current session, but will only update stored information if the user clicks 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 its settings category argument, to determine whether a particular group of settings must be saved.For instance, in the following example, the VSPackage always requests that its command bar state be saved, but it only requests that its key binding state be saved if a flag has been set.

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;
}

Community Additions

ADD
Show:
© 2014 Microsoft