Interfaccia DTE2
Aggiornamento: novembre 2007
Oggetto di primo livello nel modello a oggetti di automazione di Visual Studio.
Spazio dei nomi: EnvDTE80
Assembly: EnvDTE80 (in EnvDTE80.dll)
Sintassi
<GuidAttribute("2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")> _
Public Interface DTE2 _
Implements _DTE
Dim instance As DTE2
[GuidAttribute("2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")]
public interface DTE2 : _DTE
[GuidAttribute(L"2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")]
public interface class DTE2 : _DTE
public interface DTE2 extends _DTE
Note
L'oggetto DTE viene fornito dal metodo OnConnection che viene implementato alla creazione di un componente aggiuntivo. L'oggetto DTE equivale all'oggetto Application in Visual Basic.
Per accedere a proprietà specifiche di un progetto quale VBProjects o CSharpProjects, utilizzare la sintassi DTE.GetObject("VBProjects").
Per informazioni dettagliate sul riferimento allo spazio dei nomi EnvDTE e all'oggetto DTE, vedere Riferimenti agli assembly di automazione e all'oggetto DTE2.
Esempi
Sub DTEExample()
Dim objTextDoc As TextDocument
Dim objEP As EditPoint
'Create a new text document.
DTE2.ItemOperations.NewFile("General\Text File")
'Get a handle to the new document.
Set objTextDoc = DTE2.ActiveDocument.Object("TextDocument")
Set objEP = objTextDoc.StartPoint.CreateEditPoint
'Create an EditPoint and add some text.
objEP.Insert "A test sentence."
End Sub