IDTExtensibility2.OnConnection 메서드

업데이트: 2007년 11월

추가 기능이 Visual Studio에 로드될 때마다 발생합니다.

네임스페이스:  Extensibility
어셈블리:  Extensibility(Extensibility.dll)

구문

Sub OnConnection ( _
    Application As Object, _
    ConnectMode As ext_ConnectMode, _
    AddInInst As Object, _
    ByRef custom As Array _
)

Dim instance As IDTExtensibility2
Dim Application As Object
Dim ConnectMode As ext_ConnectMode
Dim AddInInst As Object
Dim custom As Array

instance.OnConnection(Application, ConnectMode, _
    AddInInst, custom)
void OnConnection(
    Object Application,
    ext_ConnectMode ConnectMode,
    Object AddInInst,
    ref Array custom
)
void OnConnection(
    [InAttribute] Object^ Application, 
    [InAttribute] ext_ConnectMode ConnectMode, 
    [InAttribute] Object^ AddInInst, 
    [InAttribute] Array^% custom
)
function OnConnection(
    Application : Object, 
    ConnectMode : ext_ConnectMode, 
    AddInInst : Object, 
    custom : Array
)

매개 변수

  • Application
    형식: System.Object

    IDE(통합 개발 환경) 인스턴스, 즉 Visual Studio 자동화 모델의 루트 개체인 DTE에 대한 참조입니다.

  • AddInInst
    형식: System.Object

    추가 기능의 고유 인스턴스에 대한 AddIn 참조입니다. 이 참조는 추가 기능의 부모 컬렉션을 확인하는 경우와 같이 나중에 사용할 수 있도록 저장됩니다.

  • custom
    형식: System.Array%

    추가 기능에서 사용할 호스트 관련 데이터를 전달하는 데 사용할 수 있는 빈 배열입니다.

설명

OnConnection은 추가 기능이 로드될 때마다 호출되므로 IDTExtensibility2의 main 메서드입니다. 이 메서드는 로드되는 추가 기능의 진입점이므로 이러한 추가 기능을 시작할 때 실행할 코드를 여기에 추가하거나 다른 함수를 호출할 수 있습니다.

예제

Public Sub OnConnection(ByVal application As Object, ByVal _
connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    applicationObject = CType(application, DTE2)
    addInInstance = CType(addInInst, AddIn)
    MsgBox("Add-in is connected.")
End Sub
public void OnConnection(object application, ext_ConnectMode 
connectMode, object addInInst, ref Array custom)
{
    applicationObject = (DTE2)application;
    addInInstance = (AddIn)addInInst;
    System.Windows.Forms.MessageBox.Show("Add-in has connected.");
}

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

IDTExtensibility2 인터페이스

IDTExtensibility2 멤버

Extensibility 네임스페이스

IDTExtensibility2

OnDisconnection

OnAddInsUpdate

OnBeginShutdown

OnStartupComplete

기타 리소스

방법: 추가 기능 만들기