DTE Interface

The top-level object in the Visual Studio automation object model. The documentation for the _DTE type is the most complete.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

public interface DTE extends _DTE

The DTE type exposes the following members.

Public propertyActiveDocumentGets the active document. (Inherited from _DTE.)
Public propertyActiveSolutionProjectsGets an array of currently selected projects. (Inherited from _DTE.)
Public propertyActiveWindowReturns the currently active window, or the top-most window if no others are active. (Inherited from _DTE.)
Public propertyAddInsGets the AddIns collection, which contains all currently available add-ins. (Inherited from _DTE.)
Public propertyApplicationInfrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public propertyCommandBarsGets a reference to the development environment's command bars. (Inherited from _DTE.)
Public propertyCommandLineArgumentsGets a string representing the command line arguments. (Inherited from _DTE.)
Public propertyCommandsReturns the Commands collection. (Inherited from _DTE.)
Public propertyContextAttributesGets a ContextAttributes collection which allows automation clients to add new attributes to the current selected items in the Dynamic Help window and provide contextual help for the additional attributes. (Inherited from _DTE.)
Public propertyDebuggerGets the debugger objects. (Inherited from _DTE.)
Public propertyDisplayModeGets the display mode, either MDI or Tabbed Documents. (Inherited from _DTE.)
Public propertyDocumentsGets the collection of open documents in the development environment. (Inherited from _DTE.)
Public propertyDTEGets the top-level extensibility object. (Inherited from _DTE.)
Public propertyEditionGets a description of the edition of the environment. (Inherited from _DTE.)
Public propertyEventsGets a reference to the Events object. (Inherited from _DTE.)
Public propertyFileNameInfrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public propertyFindGets the Find object that represents global text find operations. (Inherited from _DTE.)
Public propertyFullNameGets the full path and name of the object's file. (Inherited from _DTE.)
Public propertyGlobalsGets the Globals object that contains values that may be saved in the solution (.sln) file, the project file, or in the user's profile data. (Inherited from _DTE.)
Public propertyIsOpenFileInfrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public propertyItemOperationsGets the ItemOperations object. (Inherited from _DTE.)
Public propertyLocaleIDGets the ID of the locale in which the development environment is running. (Inherited from _DTE.)
Public propertyMacrosGets the Macros object. (Inherited from _DTE.)
Public propertyMacrosIDEGets the root of the Macros IDE's automation model. (Inherited from _DTE.)
Public propertyMainWindowGets a Window object representing the main development environment window. (Inherited from _DTE.)
Public propertyModeGets the mode of the development environment, either debug or design. (Inherited from _DTE.)
Public propertyNameSets or gets the name of the _DTE object. (Inherited from _DTE.)
Public propertyObjectExtendersGets the ObjectExtenders object. (Inherited from _DTE.)
Public propertyPropertiesReturns a Properties collection representing all available categories and subcategories contained in the Options dialog box on the Tools menu. (Inherited from _DTE.)
Public propertyRegistryRootGets a string with the path to the root of the Visual Studio registry settings. (Inherited from _DTE.)
Public propertySelectedItemsGets a collection containing the items currently selected in the environment. (Inherited from _DTE.)
Public propertySolutionGets the Solution object that represents all open projects in the current instance of the environment and allows access to the build objects. (Inherited from _DTE.)
Public propertySourceControlGets a SourceControl object that allows you to manipulate the source code control state of the file behind the object. (Inherited from _DTE.)
Public propertyStatusBarGets the StatusBar object, representing the status bar on the main development environment window. (Inherited from _DTE.)
Public propertySuppressUIGets or sets whether UI should be displayed during the execution of automation code. (Inherited from _DTE.)
Public propertyUndoContextGets the global UndoContext object. (Inherited from _DTE.)
Public propertyUserControlSets or gets a value indicating whether the environment was launched by a user or by automation. (Inherited from _DTE.)
Public propertyVersionGets the host application's version number. (Inherited from _DTE.)
Public propertyWindowConfigurationsGets the WindowConfigurations collection, representing all available window configurations. (Inherited from _DTE.)
Public propertyWindowsGets a Windows collection containing the windows that display in the object. (Inherited from _DTE.)

Public methodExecuteCommandExecutes the specified command. (Inherited from _DTE.)
Public methodGetObjectGets an interface or object that is late-bound to the DTE object and can be accessed by name at run time. (Inherited from _DTE.)
Public methodLaunchWizardRuns a wizard with the supplied parameters. (Inherited from _DTE.)
Public methodOpenFileInfrastructure. Microsoft Internal Use Only. (Inherited from _DTE.)
Public methodQuitCloses the environment. (Inherited from _DTE.)
Public methodSatelliteDllPathReturns the computed path to the satellite DLL when given the installation directory and the file name of the DLL containing localized resources. (Inherited from _DTE.)

For details about referencing the EnvDTE namespace and the DTE object, see FAQ: Converting Add-ins to VSPackage Extensions.

Sub DTEExample()
    Dim objTextDoc As TextDocument
    Dim objEP As EditPoint
    ' Create a new text document.
    DTE.ItemOperations.NewFile("General\Text File")
    ' Get a handle to the new document.
    Set objTextDoc = DTE.ActiveDocument.Object("TextDocument")
    Set objEP = objTextDoc.StartPoint.CreateEditPoint
    ' Create an EditPoint and add some text.
    objEP.Insert "A test sentence."
End Sub
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft