Process3.Attach2 方法 (Object)
与 Attach 类似,会使调试器附加此进程,不同的是它允许您指定一个引擎或一组引擎。
命名空间: EnvDTE90
程序集: EnvDTE90(在 EnvDTE90.dll 中)
声明
Sub Attach2 ( _
Engines As Object _
)
void Attach2(
Object Engines
)
void Attach2(
[InAttribute] Object^ Engines
)
abstract Attach2 :
Engines:Object -> unit
function Attach2(
Engines : Object
)
- Engines
类型:System.Object
一个 Engines 集合。
Attach2 使您可以使用特定的调试引擎或一组引擎附加到进程。 Engines 参数可以是单一 BSTR、BSTR 的集合、单一 Engine 对象或者 Engine 对象的集合。 如果将它指定为 BSTR,则可以提供引擎名称的前几个字符或者它的 ID (GUID)。 引擎列表特定于给定的 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
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。