IVsMonitorSelection.GetCmdUIContextCookie(Guid, UInt32) IVsMonitorSelection.GetCmdUIContextCookie(Guid, UInt32) IVsMonitorSelection.GetCmdUIContextCookie(Guid, UInt32) IVsMonitorSelection.GetCmdUIContextCookie(Guid, UInt32) Method


Registers a command UI context GUID and returns cookie value.

 int GetCmdUIContextCookie(Guid % rguidCmdUI, [Runtime::InteropServices::Out] System::UInt32 % pdwCmdUICookie);
public int GetCmdUIContextCookie (ref Guid rguidCmdUI, out uint pdwCmdUICookie);
abstract member GetCmdUIContextCookie :  *  -> int
Public Function GetCmdUIContextCookie (ByRef rguidCmdUI As Guid, ByRef pdwCmdUICookie As UInteger) As Integer


Guid Guid Guid Guid

[in] GUID representing a specific command UI context. Command UI context GUID values are defined by the environment and by VSPackages to meet specific needs. See the Remarks section below for a list of command UI GUIDs defined by the environment.

UInt32 UInt32 UInt32 UInt32

[out] Pointer to a DWORD representing the GUID value in rguidCmdUI.


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


COM Signature

From vsshell.idl:

HRESULT IVsMonitorSelection::GetCmdUIContextCookie(  
   [in]  REFGUID   rguidCmdUI,  
   [out] VSCOOKIE *pdwCmdUICookie  

This method registers the specified GUID and returns a cookie to represent that GUID. The active state of the GUID can be changed by calls to the SetCmdUIContext method and can be read by calls to the IsCmdUIContextActive method.

Note Once a GUID is registered through this method, the GUID remains registered until the IDE exits.

Command UI contexts involve associating a GUID to an action or a change in the UI. They are used in a variety of situations. VSPackages often define command UI contexts to associate a GUID to the activation of a toolbar or to the availability of a command. The environment defines the following command UI contexts. VSPackages are free to define additional context GUIDs but a VSPackage must change only the context GUIDs it registers.

Command UI Context Description
UICONTEXT_SolutionBuilding Build solution or build project mode is in effect.
UICONTEXT_Debugging Debug mode is in effect. This includes running and break mode.
UICONTEXT_Dragging Drag/drop operation is taking place. The environment turns this UI context on when a drag operation begins and turns it off when the drop occurs.
UICONTEXT_FullScreenMode Full Screen command from the View menu has been selected.
UICONTEXT_DesignMode Design mode is in effect.
UICONTEXT_NoSolution There is no current solution.
UICONTEXT_EmptySolution There are no current projects. The user has created a blank solution.
UICONTEXT_SolutionHasSingleProject The current solution has one project.
UICONTEXT_SolutionHasMultipleProjects The current solution has more than one project.

Applies to