CommandWindow 介面
代表環境中的 [命令] 視窗。
命名空間: 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 型別會公開下列成員。
屬性
名稱 | 說明 | |
---|---|---|
DTE | 取得最上層的擴充性物件。 | |
Parent | 取得指定物件的直接上層父物件。 | |
TextDocument | 取得視窗或窗格的 TextDocument。 |
回頁首
方法
名稱 | 說明 | |
---|---|---|
Clear | 從視窗清除所有文字。 | |
OutputString | 傳送文字字串到 [命令] 視窗。 | |
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();
}