MSDN Library
Inhaltsverzeichnis reduzieren
Inhaltsverzeichnis erweitern

Gewusst wie: Steuern des Befehlsfensters

Aktualisiert: November 2007

The CommandWindow object represents the Command window in the Visual Studio automation model. You can use the CommandWindow object to:

  • Insert a command into the Command window and, optionally, execute it by using the SendInput method.

  • Insert informational text into the Command window by using the OutputString method.

  • Clear all text from the Command window by using the Clear method.

In addition to controlling the contents of the Command window, you can also control its characteristics, such as width and height. For more information, see Gewusst wie: Ändern des Erscheinungsbilds eines Fensters.


The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. These procedures were developed with the General Development Settings active. To change your settings, choose Import and ExportSettings on the Tools menu. For more information, see Visual Studio-Einstellungen.

This example demonstrates how to reference and use the various members of the Command window automation model. For more information about how to run the example, see Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell.

public void OnConnection(object application, ext_ConnectMode 
  connectMode, object addInInst, ref Array custom)
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.

public void CommandWinExample(DTE2 dte)
        // Get a reference to the Command window.
        CommandWindow CW = dte.ToolWindows.CommandWindow;

        // Insert informative text into the Command window.
        CW.OutputString("This takes you to the Microsoft Web site.");

        // Add a command to the Command window and execute it.
        CW.SendInput("nav", true);

        // Clear the contents of the Command window.
        System.Windows.Forms.MessageBox.Show("Clearing the Command 
    catch (Exception ex)


© 2016 Microsoft