Compartir a través de


Process2.Attach2 (Método)

Del mismo modo que Attach, hace que el depurador adjunte este proceso, aunque permite especificar un motor o un conjunto de motores.

Espacio de nombres:  EnvDTE80
Ensamblado:  EnvDTE80 (en EnvDTE80.dll)

Sintaxis

'Declaración
Sub Attach2 ( _
    Engines As Object _
)
void Attach2(
    Object Engines
)
void Attach2(
    [InAttribute] Object^ Engines
)
abstract Attach2 : 
        Engines:Object -> unit
function Attach2(
    Engines : Object
)

Parámetros

  • Engines
    Tipo: Object

    Colección de Engines.

Comentarios

Attach2 permite adjuntar a un proceso utilizando un motor de depuración concreto o un conjunto de motores. El parámetro Engines puede ser un BSTR único, una colección de BSTR, un objeto Engine único o una colección de objetos Engine. Si especifica como BSTR, se pueden proporcionar los primeros caracteres del nombre del motor o su identificador (GUID). La lista de motores es específica de un objeto Transport determinado.

Ejemplos

' 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

Seguridad de .NET Framework

Vea también

Referencia

Process2 Interfaz

EnvDTE80 (Espacio de nombres)

Otros recursos

Cómo: Compilar y ejecutar los ejemplos de código del modelo de objetos de automatización