OleMenuCommand Class

Definition

This class is an expansion of MenuCommand.

public ref class OleMenuCommand : System::ComponentModel::Design::MenuCommand, Microsoft::VisualStudio::Shell::IMenuCommandInvokeEx, Microsoft::VisualStudio::Shell::IOleMenuCommand
[System.Runtime.InteropServices.ComVisible(true)]
public class OleMenuCommand : System.ComponentModel.Design.MenuCommand, Microsoft.VisualStudio.Shell.IMenuCommandInvokeEx, Microsoft.VisualStudio.Shell.IOleMenuCommand
[<System.Runtime.InteropServices.ComVisible(true)>]
type OleMenuCommand = class
    inherit MenuCommand
    interface IOleMenuCommand
    interface IMenuCommandInvokeEx
Public Class OleMenuCommand
Inherits MenuCommand
Implements IMenuCommandInvokeEx, IOleMenuCommand
Inheritance
OleMenuCommand
Derived
Attributes
Implements

Remarks

This class implements IOleMenuCommand and <xref:Microsoft.VisualStudio.Shell.IOleCommandInvokeEx>, and derives from MenuCommand. You can use either MenuCommand or OleMenuCommand when you add a command in a Visual Studio extension. However, if the command is added dynamically, it makes more sense to use OleMenuCommand, in order to implement the BeforeQueryStatus handler.

You can find examples of this class in the following walkthroughs:

  1. MenuCommands Vs. OleMenuCommands

  2. Changing the Text of a Menu Command

  3. How to: Create Menus, SubMenus, and Shortcut Menus

Constructors

OleMenuCommand(EventHandler, CommandID)

Builds a new OleMenuCommand.

OleMenuCommand(EventHandler, CommandID, Boolean)

Builds a new OleMenuCommand

OleMenuCommand(EventHandler, CommandID, String)

Builds a new OleMenuCommand.

OleMenuCommand(EventHandler, EventHandler, CommandID)

Initializes a new instance of OleMenuCommand for the specified command with the specified invocation and status handlers.

OleMenuCommand(EventHandler, EventHandler, CommandID, String)

Initializes a new instance of OleMenuCommand for the specified command with the specified invocation and status handlers.

OleMenuCommand(EventHandler, EventHandler, EventHandler, CommandID)

Initializes a new instance of OleMenuCommand for the specified command with the specified pre-QueryStatus, invocation, and status handlers.

OleMenuCommand(EventHandler, EventHandler, EventHandler, CommandID, String)

Initializes a new instance of OleMenuCommand for the specified command with the specified pre-QueryStatus, invocation, and status handlers.

Properties

AutomationName
MatchedCommandId

Gets or sets the command ID.

OleStatus

Gets the OLE command status code for this menu item.

ParametersDescription

Gets or sets the description of the parameters of the command.

Text

Gets or sets the text for the command.

Methods

DynamicItemMatch(Int32)

Allows a dynamic item command to match the subsequent items in its list.

Invoke(Object)

Executes the command.

Invoke(Object, IntPtr)

Executes the command.

Invoke(Object, IntPtr, OLECMDEXECOPT)

Executes the command with execution options.

Events

BeforeQueryStatus

Called when a client requests the status of the command.

Applies to