Udostępnij za pośrednictwem


CommandWindow Interface

Represents the Command window in the environment.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
<GuidAttribute("509B9955-7303-48C9-90D4-E165B974E6BA")> _
Public Interface CommandWindow
[GuidAttribute("509B9955-7303-48C9-90D4-E165B974E6BA")]
public interface CommandWindow
[GuidAttribute(L"509B9955-7303-48C9-90D4-E165B974E6BA")]
public interface class CommandWindow
[<GuidAttribute("509B9955-7303-48C9-90D4-E165B974E6BA")>]
type CommandWindow =  interface end
public interface CommandWindow

The CommandWindow type exposes the following members.

Properties

  Name Description
Public property DTE Gets the top-level extensibility object.
Public property Parent Gets the immediate parent object of a given object.
Public property TextDocument Gets the TextDocument for the window or pane.

Top

Methods

  Name Description
Public method Clear Clears all text from the window.
Public method OutputString Sends a text string to the Command window.
Public method SendInput Sends a line of input to the Command window that is processed as if you typed it.

Top

Remarks

Reference this object by using DTE.Windows.Item(vsWindowKindCommand).Object.

Examples

Sub CommandWinExample(ByVal dte As DTE)
    ' Get a reference to the Command window.
    Dim win As Window = _
    DTE.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow)
    Dim CW As CommandWindow = win.Object

    ' Input a command into the Command window and execute it.
    CW.SendInput("nav https://www.microsoft.com", False)

    ' Insert some information text into the Command window.
    CW.OutputString("This URL takes you to the main Microsoft _
    website.")

    ' Clear the contents of the Command window.
    MsgBox("Clearing the Command window...")
    CW.Clear()
End Sub
void CommandWinExample(_DTE dte) 
{
    // Get a reference to the Command window.
    Window win =    
    dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
    CommandWindow CW = (CommandWindow)win.Object;

    // Input a command into the Command window and execute it.
    CW.SendInput("nav https://www.microsoft.com", false);

    // Insert some information text into the Command window.
    CW.OutputString("This URL takes you to the main Microsoft 
    website.");

    // Clear the contents of the Command window.
    MessageBox.Show("Clearing the Command window...");
    CW.Clear();
}

See Also

Reference

EnvDTE Namespace