Command (Interfaz)

Actualización: noviembre 2007

Representa un comando del entorno.

Espacio de nombres:  EnvDTE
Ensamblado:  EnvDTE (en EnvDTE.dll)

Sintaxis

<GuidAttribute("5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")> _
Public Interface Command

Dim instance As Command
[GuidAttribute("5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")]
public interface Command
[GuidAttribute(L"5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")]
public interface class Command
public interface Command

Comentarios

Se hace referencia a este objeto mediante Item.

Es posible hacer referencia a este objeto de varias maneras, como por ejemplo, utilizando el nombre canónico o el id. GUID. La forma más sencilla de invocar a la mayoría de los comandos consiste en utilizar ExecuteCommand. Se puede utilizar Raise para los raros casos en los que se debe llamar a un comando sin nombre.

Ejemplos

' Macro code.
Sub CommandExample()
  ' Creates a text document listing all command names.
  Dim Cmd As Command
  Dim Doc As Document
  Dim TxtDoc As TextDocument

  ' Create a new text document.
  DTE.ItemOperations.NewFile ("General\Text File")
  Set Doc = ActiveDocument
  Set TxtDoc = Doc.Object("TextDocument")
  For Each Cmd In Commands
  If (Cmd.Name <> "") Then
    TxtDoc.Selection.Text = Cmd.Name & vbLF
    TxtDoc.Selection.Collapse
  End If
  Next
End Sub

Vea también

Referencia

Command (Miembros)

EnvDTE (Espacio de nombres)