Metodo Process3.Attach2
Analogamente a Attach, comporta la connessione al processo da parte del debugger, con la differenza che consente di specificare un motore o un set di motori.
Spazio dei nomi: EnvDTE90
Assembly: EnvDTE90 (in EnvDTE90.dll)
Sintassi
'Dichiarazione
Sub Attach2 ( _
Engines As Object _
)
void Attach2(
Object Engines
)
void Attach2(
[InAttribute] Object^ Engines
)
abstract Attach2 :
Engines:Object -> unit
function Attach2(
Engines : Object
)
Parametri
Engines
Tipo: ObjectRaccolta Engines.
Note
Attach2 consente di connettersi a un processo utilizzando un insieme di moduli o un modulo di gestione di debug specifico. Il parametro Engines può essere dato da un singolo BSTR, da una raccolta di BSTR, da un singolo oggetto Engine o da una raccolta di oggetti Engine. Se viene specificato come BSTR, è possibile fornire il GUID o i primi caratteri del nome del motore. L'elenco di moduli è specifico di un determinato oggetto Transport.
Esempi
' 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
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per altre informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.