We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

IDTExtensibility2::OnConnection Method

Occurs whenever an add-in is loaded into Visual Studio.

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

void OnConnection(
	[InAttribute] Object^ Application, 
	[InAttribute] ext_ConnectMode ConnectMode, 
	[InAttribute] Object^ AddInInst, 
	[InAttribute] Array^% custom


Type: System::Object
A reference to an instance of the integrated development environment (IDE), DTE, which is the root object of the Visual Studio automation model.
Type: Extensibility::ext_ConnectMode
An ext_ConnectMode enumeration value that indicates the way the add-in was loaded into Visual Studio.
Type: System::Object
An AddIn reference to the add-in's own instance. This is stored for later use, such as determining the parent collection for the add-in.
Type: System::Array%
An empty array that you can use to pass host-specific data for use in the add-in.

OnConnection is the main method for IDTExtensibility2, because it is called every time an add-in is loaded. It is the entry point for an add-in when it is loaded, so you can put any code here (or call any another function) that you want to run when the add-in starts.

No code example is currently available or this language may not be supported.