表示环境中的**“命令”**窗口。
命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)
语法
声明
<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
CommandWindow 类型公开以下成员。
属性
| 名称 | 说明 | |
|---|---|---|
| .gif) | DTE | 获取顶级扩展性对象。 | 
| .gif) | Parent | 获取给定对象的直接父对象。 | 
| .gif) | TextDocument | 获取窗口或窗格的 TextDocument。 | 
页首
方法
| 名称 | 说明 | |
|---|---|---|
| .gif) | Clear | 从窗口中清除所有文本。 | 
| .gif) | OutputString | 将文本字符串发送到“命令”窗口。 | 
| .gif) | SendInput | 将输入行发送到“命令”窗口,处理方式就像您键入输入行一样。 | 
页首
备注
使用 DTE.Windows.Item(vsWindowKindCommand).Object 可引用此对象。
示例
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();
}