Udostępnij za pośrednictwem


Metoda Process3.Attach2 —

Podobny do Attach, powoduje, że debugera dołączyć ten proces, z wyjątkiem, że umożliwia określenie silnika lub silników zestaw.

Przestrzeń nazw:  EnvDTE90
Zestaw:  EnvDTE90 (w EnvDTE90.dll)

Składnia

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

Parametry

  • Engines
    Typ: Object

    A Engines kolekcji.

Uwagi

Attach2Pozwala dołączyć do procesu przy użyciu określonego aparatu debugowania lub zestaw silników.Engines Parametr może być pojedynczy BSTR, Kolekcja BSTRs, pojedynczego Engine obiekt lub zbiór Engine obiektów.Jeśli określisz jako typu BSTR kilka pierwszych znaków nazwy silnika lub jego identyfikator (GUID) mogą być dostarczone.Lista silników jest specyficzne dla danego Transport.

Przykłady

' 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

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

Process3 Interfejs

Przestrzeń nazw EnvDTE90