次の方法で共有


ViewFilter.IOleCommandTarget.QueryStatus Method

Determines if the specified commands in the given command group are supported.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)

Syntax

'宣言
Private Function QueryStatus ( _
    ByRef guidCmdGroup As Guid, _
    cCmds As UInteger, _
    prgCmds As OLECMD(), _
    pCmdText As IntPtr _
) As Integer Implements IOleCommandTarget.QueryStatus
'使用
Dim instance As ViewFilter
Dim guidCmdGroup As Guid
Dim cCmds As UInteger
Dim prgCmds As OLECMD()
Dim pCmdText As IntPtr
Dim returnValue As Integer

returnValue = CType(instance, IOleCommandTarget).QueryStatus(guidCmdGroup, _
    cCmds, prgCmds, pCmdText)
int IOleCommandTarget.QueryStatus(
    ref Guid guidCmdGroup,
    uint cCmds,
    OLECMD[] prgCmds,
    IntPtr pCmdText
)
private:
virtual int QueryStatus(
    Guid% guidCmdGroup, 
    unsigned int cCmds, 
    array<OLECMD>^ prgCmds, 
    IntPtr pCmdText
) sealed = IOleCommandTarget::QueryStatus
private abstract QueryStatus : 
        guidCmdGroup:Guid byref * 
        cCmds:uint32 * 
        prgCmds:OLECMD[] * 
        pCmdText:IntPtr -> int 
private override QueryStatus : 
        guidCmdGroup:Guid byref * 
        cCmds:uint32 * 
        prgCmds:OLECMD[] * 
        pCmdText:IntPtr -> int 
JScript does not support explicit interface implementations.

Parameters

  • guidCmdGroup
    Type: System.Guid%
    [in] The GUID of the command group.
  • cCmds
    Type: System.UInt32
    [in] The number of command IDs listed in the prgCmds array.
  • pCmdText
    Type: System.IntPtr
    [in, out] An umarshaled pointer to an OLECMDTEXT structure that receives the name for each command that is supported.

Return Value

Type: System.Int32
If successful, returns S_OK; otherwise, returns an error code. A typical error code that can be returned is OLECMDERR_E_UNKNOWNGROUP, indicating the command group is not supported.

Implements

IOleCommandTarget.QueryStatus(Guid%, UInt32, array<OLECMD[], IntPtr)

Remarks

This method is called to get the support status of all commands in the list for the specified command group. This information is used to enable or disable menu options and to determine what commands should be passed to the Exec method on the IOleCommandTarget interface (although Exec should make its own check for support as well).

This method is an implementation of the QueryStatus method on the IOleCommandTarget interface.

The base method calls the QueryCommandStatus method for each command in the list and stores the result in the OLECMD structure for that command. If QueryCommandStatus returns an error (such as OLECMDERR_E_UNKNOWNGROUP), then the base method calls the QueryStatus method on the next command target in the chain and returns the result immediately, skipping all remaining commands in the list (this means that the QueryCommandStatus method must report a valid status (supported or not supported) for all commands given to it unless the entire group is unsupported in which case QueryCommandStatus returns OLECMDERR_E_UNKNOWNGROUP). The base method does not set the command name in the pCmdText structure since the default managed package framework's implementation of the language service classes does not need to change the name of any existing command.

.NET Framework Security

See Also

Reference

ViewFilter Class

ViewFilter Members

Microsoft.VisualStudio.Package Namespace