Share via


Command インターフェイス

環境でコマンドを表示します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
<GuidAttribute("5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")> _
Public Interface Command
[GuidAttribute("5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")]
public interface Command
[GuidAttribute(L"5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")]
public interface class Command
[<GuidAttribute("5FE10FB0-91A1-4E55-BAAA-ECCAE5CCEB94")>]
type Command =  interface end
public interface Command

Command 型で公開されるメンバーは以下のとおりです。

プロパティ

  名前 説明
パブリック プロパティ Bindings コマンドの呼び出しに使うキーストロークのリストを設定または取得します。
パブリック プロパティ Collection Command オブジェクトを含む Commands コレクションを取得します。
パブリック プロパティ DTE トップレベルの機能拡張オブジェクトを取得します。
パブリック プロパティ Guid 特定のオブジェクトの GUID を取得します。
パブリック プロパティ ID コマンドを表すために使用するコマンド グループ GUID 内の ID を取得します。
パブリック プロパティ IsAvailable Command が現在有効であるかどうかを示す値を取得します。
パブリック プロパティ LocalizedName コマンドのローカライズされた名前を取得します。
パブリック プロパティ Name オブジェクトの名前を取得します。

このページのトップへ

メソッド

  名前 説明
パブリック メソッド AddControl コマンドの永続的なコマンド バー コントロールを作成します。
パブリック メソッド Delete AddNamedCommand メソッドで作成した名前付きコマンドを削除します。

このページのトップへ

解説

このオブジェクトを参照するには、Item を使用します。

このオブジェクトは、標準名や GUID ID などのさまざまな方法で参照できます。 ほとんどのコマンドを起動する最も簡単な方法は、ExecuteCommand を使用することです。 まれに、名前なしでコマンドを呼び出す必要があるときに、Raise を使用します。

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

参照

関連項目

EnvDTE 名前空間