Process3.Attach2(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
void Attach2(System::Object ^ Engines);
void Attach2(winrt::Windows::Foundation::IInspectable const & Engines = );
[System.Runtime.InteropServices.DispId(1001)]
public void Attach2 (object Engines = );
[System.Runtime.InteropServices.DispId(1001)]
public void Attach2 (object Engines);
[<System.Runtime.InteropServices.DispId(1001)>]
abstract member Attach2 : obj -> unit
Public Sub Attach2 (Optional Engines As Object = )
Public Sub Attach2 (Engines As Object)
Parameters
Implements
- Attributes
Examples
' 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
Remarks
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.