Partager via


IVsMonitorSelection.IsCmdUIContextActive Method

Determines whether a specific command UI context is active.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Déclaration
Function IsCmdUIContextActive ( _
    dwCmdUICookie As UInteger, _
    <OutAttribute> ByRef pfActive As Integer _
) As Integer
'Utilisation
Dim instance As IVsMonitorSelection
Dim dwCmdUICookie As UInteger
Dim pfActive As Integer
Dim returnValue As Integer

returnValue = instance.IsCmdUIContextActive(dwCmdUICookie, _
    pfActive)
int IsCmdUIContextActive(
    uint dwCmdUICookie,
    out int pfActive
)
int IsCmdUIContextActive(
    [InAttribute] unsigned int dwCmdUICookie, 
    [OutAttribute] int% pfActive
)
function IsCmdUIContextActive(
    dwCmdUICookie : uint, 
    pfActive : int
) : int

Parameters

  • dwCmdUICookie
    Type: System.UInt32

    [in] DWORD representation of the GUID identifying the command UI context passed in as the rguidCmdUI parameter in the call to GetCmdUIContextCookie.

  • pfActive
    Type: System.Int32%

    [out] Flag set to true if the command UI context identified by dwCmdUICookie is active and false otherwise.

Return Value

Type: System.Int32

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsMonitorSelection::IsCmdUIContextActive(
   [in]  VSCOOKIE  dwCmdUICookie,
   [out] BOOL     *pfActive
);

Command UI contexts are associations between a GUID and a command that affects the UI. It is monitored by the SVsShellMonitorSelection service and set by VSPackages as necessary. Typical uses of the command UI context are to activate a particular mode such as design mode or debug mode and to selectively display a toolbar or menu command. To toggle the state of a command UI context, call SetCmdUIContext.

Permissions

See Also

Reference

IVsMonitorSelection Interface

IVsMonitorSelection Members

Microsoft.VisualStudio.Shell.Interop Namespace