共用方式為


IVsUserContextUpdate.UpdateUserContext(IVsUserContext, UInt32) Method

Definition

Sends notification that the context is being updated. This method also clears the dirty flag from the context bag.

public:
 int UpdateUserContext(Microsoft::VisualStudio::Shell::Interop::IVsUserContext ^ pCtx, System::UInt32 dwCookie);
public:
 int UpdateUserContext(Microsoft::VisualStudio::Shell::Interop::IVsUserContext ^ pCtx, unsigned int dwCookie);
int UpdateUserContext(Microsoft::VisualStudio::Shell::Interop::IVsUserContext const & pCtx, unsigned int dwCookie);
public int UpdateUserContext (Microsoft.VisualStudio.Shell.Interop.IVsUserContext pCtx, uint dwCookie);
abstract member UpdateUserContext : Microsoft.VisualStudio.Shell.Interop.IVsUserContext * uint32 -> int
Public Function UpdateUserContext (pCtx As IVsUserContext, dwCookie As UInteger) As Integer

Parameters

pCtx
IVsUserContext

[in] Pointer to the IVsUserContextUpdate interface (the context bag) to update.

dwCookie
UInt32

[in] Parameter is not currently used.

Returns

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

Remarks

COM Signature

From context.idl:

HRESULT IVsUserContextUpdate::UpdateUserContext(  
   [in] IVsUserContext * pCtx,  
   [in] VSCOOKIE dwCookie  
);  

When you create a context bag for an editor or designer, call AdviseUpdate and pass along a pointer to your context provider. When Update is called internally by the environment, each context bag in the active selection is updated. For each context bag that has called AdviseUpdate and has implemented IVsUserContextUpdate, the environment calls UpdateUserContext to inform the context provider that the context bag will be updated. You can use this call to change the attributes and keywords in the context bag before the update occurs.

If necessary, a context provider can provide notification that the context needs to be updated by calling SetDirty on the context bag. Using this approach, you do not need to supply the context until Update has been called.

Note

The SetDirty flag is automatically set to true whenever context is added or removed from the context bag.

Applies to