Process2.Attach2 メソッド
更新 : 2007 年 11 月
デバッガがこのプロセスにアタッチされる Attach と同様に、エンジンまたはエンジンのセットを指定できます。
名前空間 : EnvDTE80
アセンブリ : EnvDTE80 (EnvDTE80.dll 内)
構文
'宣言
Sub Attach2 ( _
Engines As Object _
)
'使用
Dim instance As Process2
Dim Engines As Object
instance.Attach2(Engines)
void Attach2(
Object Engines
)
void Attach2(
[InAttribute] Object^ Engines
)
function Attach2(
Engines : Object
)
パラメータ
Engines
型 : System.ObjectEngines コレクション。
解説
Attach2 を使用すると、特定のデバッグ エンジンまたはエンジンのセットを使用してプロセスにアタッチできます。Engines パラメータは、1 つの BSTR、BSTR のコレクション、1 つの 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 System.Diagnostics
Imports Microsoft.VisualBasic.ControlChars
Public Module Module1
Sub NativeAttachToLocalCalc()
Dim dbg2 As EnvDTE80.Debugger2
dbg2 = DTE.Debugger
Dim attached As Boolean = False
Dim proc As EnvDTE80.Process2
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 EnvDTE80.Debugger2
dbg2 = DTE.Debugger
Dim attached As Boolean = False
Dim proc As EnvDTE80.Process2
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
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。