Freigeben über


Command.Guid Property

Definition

Gets the GUID for the given object.

public:
 property System::String ^ Guid { System::String ^ get(); };
public:
 property Platform::String ^ Guid { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(4)]
public string Guid { [System.Runtime.InteropServices.DispId(4)] get; }
[<System.Runtime.InteropServices.DispId(4)>]
[<get: System.Runtime.InteropServices.DispId(4)>]
member this.Guid : string
Public ReadOnly Property Guid As String

Property Value

A string representing the command group GUID used to represent the command.

Attributes

Examples

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();  
    }  
}  

Applies to