
384Microsoft Visual Studio 2010: A Beginner’s Guide
Reviewing the OnConnection Method
As you learned earlier, the Connect class implements various interface methods so that VS can call into those methods to run your
Understanding OnConnection Parameters
The OnConnection method has four parameters. Each of the parameters are passed to the OnConnection method by VS; these parameters provide all of the information necessary for initializing the
Member
Type
Purpose
application | Application is the parent object for the entire VS | |
| the runtime type is defined by the | automation model. You use this to access all of the |
| version you’re at. For example, | windows, commands, and other parts of the IDE. |
| on older versions of VS, the |
|
| runtime type of Application was |
|
| DTE, but the runtime type of |
|
| Application in VS 2010 is DTE2. |
|
connectMode | Enum of type ext_ConnectMode | Read this parameter to figure out when and how |
|
| the |
|
| you’ll see how the OnConnection method reads this |
|
| value to figure out when the |
|
| first time. |
addInInst | The | This refers to the |
| but runtime type is AddIn. | inspect various properties of the |
custom | Array | These aren’t used in the current example, but |
|
| consider the fact that we’re implementing an |
|
| interface. Besides VS 2010, you could have |
|
| another application (host) that supported |
|
| that implement the IDTExtensibility2 interface. Those |
|
| hosts could use the custom array parameter to pass |
|
| information specific to that application. Therefore, |
|
| custom is another extensibility point to make the |
|
| IDTExtensibility2 interface more flexible. |
|
|
|