次の方法で共有


Command.Guid プロパティ

特定のオブジェクトの GUID を取得します。

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

構文

'宣言
ReadOnly Property Guid As String
string Guid { get; }
property String^ Guid {
    String^ get ();
}
abstract Guid : string with get
function get Guid () : String

プロパティ値

型 : String
コマンドを表すために使用するコマンド グループ GUID を表す文字列。

Sub GuidExample(ByVal dte As DTE2)

    ' Create a new text document.
    Dim win As Window = dte.ItemOperations.NewFile()
    Dim textWin As TextWindow = CType(win.Object, TextWindow)

    ' Split the text document window.
    Dim cmd As Command = dte.Commands.Item("Window.Split")
    dte.Commands.Raise(cmd.Guid, cmd.ID, Nothing, Nothing)

    If MsgBox("Activate the top pane?", MsgBoxStyle.YesNo) = _
        MsgBoxResult.Yes Then

        ' In a split window, the top pane is always at index 2 of the 
        ' Panes collection.
        textWin.Panes.Item(2).Activate()
    Else
        textWin.Panes.Item(1).Activate()
    End If

End Sub
public void GuidExample(DTE2 dte)
{
    // Create a new text document.
    Window win = dte.ItemOperations.NewFile(@"General\Text File", "", 
        Constants.vsViewKindPrimary);
    TextWindow textWin = (TextWindow)win.Object;

    // Split the text document window.
    Command cmd = dte.Commands.Item("Window.Split", -1);
    object dummy = new object();
    dte.Commands.Raise(cmd.Guid, cmd.ID, ref dummy, ref dummy);

    if (MessageBox.Show("Activate the top pane?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        // In a split window, the top pane is always at index 2 of the 
        // Panes collection.
        textWin.Panes.Item(2).Activate();
    }
    else
    {
        textWin.Panes.Item(1).Activate();
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Command インターフェイス

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する