Process3::Attach2 Method (Object^)
Visual Studio 2015
Similar to Attach, causes the debugger to attach this process, except that it allows you to specify an engine or set of engines.
Assembly: EnvDTE90 (in EnvDTE90.dll)
Parameters
- Engines
-
Type:
System::Object^
A Engines collection.
Implements
Process2::Attach2(Object^)Attach2 allows you to attach to a process using a specific debugging engine or set of engines. The Engines parameter can be a single BSTR, a collection of BSTRs, a single Engine object or a collection of Engine objects. If you specify it as a BSTR, the first few characters of the engine name or its ID (GUID) can be supplied. The list of engines is specific to a given 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
Show: