Share via


OleMenuCommand Class

Represents a menu command in Visual Studio.

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

Syntax

'Declaration
<ComVisibleAttribute(True)> _
Public Class OleMenuCommand _
    Inherits MenuCommand _
    Implements IOleMenuCommand, IMenuCommandInvokeEx
'Usage
Dim instance As OleMenuCommand
[ComVisibleAttribute(true)]
public class OleMenuCommand : MenuCommand, 
    IOleMenuCommand, IMenuCommandInvokeEx
[ComVisibleAttribute(true)]
public ref class OleMenuCommand : public MenuCommand, 
    IOleMenuCommand, IMenuCommandInvokeEx
public class OleMenuCommand extends MenuCommand implements IOleMenuCommand, IMenuCommandInvokeEx

Remarks

This class implements IOleMenuCommand and 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. How to: Create and Handle Commands in VSPackages (C#)

  2. How to: Change the Text of a Menu Command

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

Inheritance Hierarchy

System.Object
  System.ComponentModel.Design.MenuCommand
    Microsoft.VisualStudio.Shell.OleMenuCommand

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

OleMenuCommand Members

Microsoft.VisualStudio.Shell Namespace