DTE2 介面
在 Visual Studio Automation 物件模型中最上層的物件。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
<GuidAttribute("2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")> _
Public Interface DTE2 _
Inherits _DTE
[GuidAttribute("2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")]
public interface DTE2 : _DTE
[GuidAttribute(L"2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")]
public interface class DTE2 : _DTE
[<GuidAttribute("2EE1E9FA-0AFE-4348-A89F-ED9CB45C99CF")>]
type DTE2 =
interface
interface _DTE
end
public interface DTE2 extends _DTE
DTE2 類型會公開下列成員。
屬性
名稱 | 描述 | |
---|---|---|
![]() |
ActiveDocument | 取得現用文件。 |
![]() |
ActiveSolutionProjects | 取得目前所選取專案的陣列。 |
![]() |
ActiveWindow | 取得目前使用中的視窗;如果沒有其他視窗是作用中,則傳回最上層視窗。 |
![]() |
AddIns | 取得 AddIns 集合,此集合包含所有目前可用的增益集。 |
![]() |
Application | 基礎架構。 僅限 Microsoft 內部使用。 |
![]() |
CommandBars | 取得對開發環境中 CommandBars 物件的參考。 |
![]() |
CommandLineArguments | 取得字串,表示命令列引數。 |
![]() |
Commands | 取得 Commands 集合。 |
![]() |
ContextAttributes | 取得 ContextAttributes 集合,它可以讓 Automation 用戶端將新屬性加入至 [動態說明] 視窗中目前選取的項目,並且為其他屬性提供內容說明。 |
![]() |
Debugger | 取得 Debugger 物件。 |
![]() |
DisplayMode | 取得或設定顯示模式,可能是 MDI 或是索引標籤式文件。 |
![]() |
Documents | 取得開發環境中已開啟文件的集合。 |
![]() |
DTE | 取得最上層的擴充性物件。 |
![]() |
Edition | 取得環境的版本說明。 |
![]() |
Events | 取得 Events 物件的參考。 |
![]() |
FileName | 基礎架構。 僅限 Microsoft 內部使用。 |
![]() |
Find | 取得 Find 物件,表示全域文字尋找作業。 |
![]() |
FullName | 取得物件檔案的完整路徑和名稱。 |
![]() |
Globals | 取得 Globals 物件,此物件包含可能儲存在方案檔 (.sln)、專案檔,或使用者設定檔資料中的增益集值。 |
![]() |
IsOpenFile | 基礎架構。 僅限 Microsoft 內部使用。 |
![]() |
ItemOperations | 取得 ItemOperations 物件。 |
![]() |
LocaleID | 取得執行中開發環境所使用的地區設定 (Locale) ID。 |
![]() |
Macros | 取得 Macros 物件。 |
![]() |
MacrosIDE | 取得巨集 IDE 之 Automation 模型的根物件。 |
![]() |
MainWindow | 取得 Window 物件,表示主開發環境視窗。 |
![]() |
Mode | 取得開發環境的模式,即偵錯或設計模式。 |
![]() |
Name | 取得 DTE 的名稱。 |
![]() |
ObjectExtenders | 取得 ObjectExtenders 物件。 |
![]() |
Properties | 取得 Properties 集合,此集合代表 [工具] 功能表的 [選項] 對話方塊中所包含的所有可用分類和子分類。 |
![]() |
RegistryRoot | 取得含有 Visual Studio 登錄設定根目錄路徑的字串。 |
![]() |
SelectedItems | 取得包含目前環境中所選取之項目的集合。 |
![]() |
Solution | 取得 Solution 物件,此物件代表目前環境執行個體中所有開啟專案,並且允許存取建置物件。 |
![]() |
SourceControl | 取得 SourceControl 物件,此物件可讓您管理此物件後檔案的原始程式碼控制狀態。 |
![]() |
StatusBar | 取得 StatusBar 物件,此物件代表主開發環境視窗中的狀態列。 |
![]() |
SuppressUI | 取得或設定值,指出在 Automation 程式碼執行期間是否顯示使用者介面 (UI)。 |
![]() |
ToolWindows | 取得 ToolWindows 物件,此物件是用來當做尋找工具視窗的捷徑。 |
![]() |
UndoContext | 取得全域 UndoContext 物件。 |
![]() |
UserControl | 取得值,指出環境是由使用者或 Automation 啟動。 |
![]() |
Version | 取得主應用程式 (Host Application) 的版本編號。 |
![]() |
WindowConfigurations | 取得 WindowConfigurations 集合,此集合代表所有可用的視窗組態。 |
![]() |
Windows | 取得 Windows 集合,該集合包含物件中顯示的視窗。 |
回頁首
方法
名稱 | 描述 | |
---|---|---|
![]() |
ExecuteCommand | 執行指定命令。 |
![]() |
GetObject | 取得晚期繫結 (Late-bound) 至 DTE 物件,並可在執行階段以名稱存取的介面或物件。 |
![]() |
GetThemeColor | 取得色彩,用以在 Visual Studio 內繪製使用者介面。 |
![]() |
LaunchWizard | 以提供的參數執行精靈。 |
![]() |
OpenFile | 基礎架構。 僅限 Microsoft 內部使用。 |
![]() |
Quit | 關閉 Visual Studio 環境。 |
![]() |
SatelliteDllPath | 傳回已知某一增益集或精靈的安裝目錄時附屬 DLL (Satellite DLL) 的計算路徑,以及含有當地語系化資源的 DLL 檔名。 |
回頁首
備註
DTE 物件是由 OnConnection 方法提供給您的,而這個方法則是在建立增益集時所實作。 DTE 物件是 Visual Basic 中的 Application 物件。
若要存取 VBProjects 或 CSharpProjects 等專案特定屬性,請使用 DTE.GetObject("VBProjects") 語法。
如需參考 EnvDTE 命名空間和 DTE 物件的詳細資訊,請參閱參考 Automation 組件和 DTE2 物件。
範例
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