다음을 통해 공유


Process3.Attach2 메서드 (Object)

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

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

구문

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

매개 변수

구현

Process2.Attach2(Object)

설명

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 EnvDTE90
Imports System.Diagnostics
Imports Microsoft.VisualBasic.ControlChars

Public Module Module1

    Sub NativeAttachToLocalCalc()
        Dim dbg2 As EnvDTE90.Debugger3
        dbg2 = DTE.Debugger

        Dim attached As Boolean = False
        Dim proc As EnvDTE90.Process3
        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 EnvDTE90.Debugger3
        dbg2 = DTE.Debugger

        Dim attached As Boolean = False
        Dim proc As EnvDTE90.Process3
        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 보안

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

참고 항목

참조

Process3 인터페이스

Attach2 오버로드

EnvDTE90 네임스페이스