다음을 통해 공유


Process2.Attach2 메서드

Attach와 마찬가지로 이 프로세스에 디버거를 연결하지만 엔진이나 엔진 집합만 지정할 수 있습니다.

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

구문

‘선언
Sub Attach2 ( _
    Engines As Object _
)
void Attach2(
    Object Engines
)
void Attach2(
    [InAttribute] Object^ Engines
)
abstract Attach2 : 
        Engines:Object -> unit
function Attach2(
    Engines : Object
)

매개 변수

  • Engines
    형식: Object

    Engines 컬렉션입니다.

설명

Attach2를 사용하면 특정 디버깅 엔진이나 엔진 집합을 통해 프로세스에 연결할 수 있습니다. Engines 매개 변수는 단일 BSTR, BSTR 컬렉션, 단일 Engine 개체 또는 Engine 개체 컬렉션일 수 있습니다. BSTR로 지정한 경우 엔진 이름의 처음 문자 몇 개나 해당 ID(GUID)를 제공할 수 있습니다. 엔진 목록은 지정된 Transport에만 해당됩니다.

예제

' Macro code.
' The examples below illustrate how to attach to default, local, and 
' remote processes.
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Imports Microsoft.VisualBasic.ControlChars

Public Module Module1

    Sub NativeAttachToLocalCalc()
        Dim dbg2 As EnvDTE80.Debugger2
        dbg2 = DTE.Debugger

        Dim attached As Boolean = False
        Dim proc As EnvDTE80.Process2
        For Each proc In DTE.Debugger.LocalProcesses
            If (Right(proc.Name, 8) = "calc.exe") Then
                proc.Attach2("native")
                attached = True
                Exit For
            End If
        Next

        If attached = False Then
            If attached = False Then
                MsgBox("calc.exe isn't running")
            End If
        End If
    End Sub

    Sub DefaultAttachToLocalCalc()
        Dim dbg2 As EnvDTE80.Debugger2
        dbg2 = DTE.Debugger

        Dim attached As Boolean = False
        Dim proc As EnvDTE80.Process2
        For Each proc In DTE.Debugger.LocalProcesses
            If (Right(proc.Name, 8) = "calc.exe") Then
                proc.Attach2()
                attached = True
                Exit For
            End If
        Next

        If attached = False Then
            If attached = False Then
                MsgBox("calc.exe isn't running")
            End If
        End If
    End Sub
End Module

.NET Framework 보안

참고 항목

참조

Process2 인터페이스

EnvDTE80 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행