IVsUserSettingsQuery.NeedExport Method
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)
Syntax
'宣言
Function NeedExport ( _
szCategoryGUID As String, _
<OutAttribute> ByRef pfNeedExport As Integer _
) As Integer
'使用
Dim instance As IVsUserSettingsQuery
Dim szCategoryGUID As String
Dim pfNeedExport As Integer
Dim returnValue As Integer
returnValue = instance.NeedExport(szCategoryGUID, _
pfNeedExport)
int NeedExport(
string szCategoryGUID,
out int pfNeedExport
)
int NeedExport(
[InAttribute] String^ szCategoryGUID,
[OutAttribute] int% pfNeedExport
)
function NeedExport(
szCategoryGUID : String,
pfNeedExport : int
) : int
Parameters
szCategoryGUID
Type: System.String[in] GUID identifying the particular settings category (defined by a Custom Settings Point) being queried.
pfNeedExport
Type: System.Int32%[out] Boolean value returned to indicate if the IDE should call the VSPackage's export settings implementation.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
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.
Examples
In this example, the VSPackage always requests that its command bar state is saved, but only requests its key binding state be saved it 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;
}
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Concepts
How to: Use Interop Assemblies to Import Settings
Reference
IVsUserSettingsQuery Interface