CommandWindow.DTE Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft das Erweiterbarkeitsobjekt der obersten Ebene ab.
public:
property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
public:
property EnvDTE::DTE ^ DTE { EnvDTE::DTE ^ get(); };
[System.Runtime.InteropServices.DispId(1)]
public EnvDTE.DTE DTE { [System.Runtime.InteropServices.DispId(1)] get; }
[<System.Runtime.InteropServices.DispId(1)>]
[<get: System.Runtime.InteropServices.DispId(1)>]
member this.DTE : EnvDTE.DTE
Public ReadOnly Property DTE As DTE
Eigenschaftswert
Ein DTE-Objekt.
- Attribute
Beispiele
public void CodeExample(DTE2 dte, AddIn addin)
{
try
{
// Get a reference to a Command window.
Window win = dte.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
CommandWindow cmdWin = (CommandWindow)win.Object;
// Add some text to the window.
cmdWin.OutputString("This is a line of text in the CommandWindow TextDocument");
// Return the contents of the TextDocument and display them.
TextDocument txtDoc = cmdWin.TextDocument;
TextSelection txtSel = txtDoc.Selection;
TextRanges txtRanges = txtSel.TextRanges;
// Show text in textdocument.
foreach (TextRange txtRange in txtRanges)
{
txtRange.StartPoint.StartOfDocument();
MessageBox.Show(txtRange.StartPoint.GetText(txtRange.EndPoint));
}
// Show the CommandWindow's parent object's caption property
MessageBox.Show("The Parent window's caption: " + cmdWin.Parent.Caption);
// Show the application object containing the CommandWindow.
MessageBox.Show(cmdWin.DTE.Name);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Hinweise
In Visual Studio ist das DTE Objekt der Stamm des Automatisierungs Modells, das von anderen Objekt Modellen oft als "Application" bezeichnet wird.