Share via


OleMenuCommandService.GlobalInvoke Method

Definition

Overloads

GlobalInvoke(CommandID)

Can be used to invoke any command within Visual Studio.

GlobalInvoke(CommandID, Object)

Can be used to invoke any command within Visual Studio.

GlobalInvoke(CommandID)

Can be used to invoke any command within Visual Studio.

public:
 override bool GlobalInvoke(System::ComponentModel::Design::CommandID ^ commandID);
public override bool GlobalInvoke (System.ComponentModel.Design.CommandID commandID);
abstract member GlobalInvoke : System.ComponentModel.Design.CommandID -> bool
override this.GlobalInvoke : System.ComponentModel.Design.CommandID -> bool
Public Overrides Function GlobalInvoke (commandID As CommandID) As Boolean

Parameters

commandID
CommandID

The command ID of the command to search for and execute.

Returns

true if the invocation succeeded; otherwise, false.

Remarks

The GlobalInvoke method can be used to invoke any command within Visual Studio. Visual Studio uses a built-in search hierarchy to search for the requested command. The search pattern favors the current document window and then moves out to broader focus.

Applies to

GlobalInvoke(CommandID, Object)

Can be used to invoke any command within Visual Studio.

public:
 override bool GlobalInvoke(System::ComponentModel::Design::CommandID ^ commandID, System::Object ^ arg);
public override bool GlobalInvoke (System.ComponentModel.Design.CommandID commandID, object arg);
abstract member GlobalInvoke : System.ComponentModel.Design.CommandID * obj -> bool
override this.GlobalInvoke : System.ComponentModel.Design.CommandID * obj -> bool
Public Overrides Function GlobalInvoke (commandID As CommandID, arg As Object) As Boolean

Parameters

commandID
CommandID

The command ID of the command to search for and execute.

arg
Object

The optional command argument.

Returns

true if the invocation succeeded; otherwise, false.

Remarks

Visual Studio uses a built-in search hierarchy to search for the requested command. The search pattern favors the current document window and then moves out to broader focus.

Some commands may take optional arguments, and they can be passed to the handler of the command via the arg parameter of GlobalInvoke. For instance, a Find command may accept a string representing the text to find. An OpenFile command may take a file name as an argument. If a command can use an optional argument, it defines what is expected and should document how one would invoke the command with optional arguments.

Applies to