Process2 对象用于检查和操作进程。 Process2 对象取代了 Process 对象。
命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
<GuidAttribute("95AC1923-6EAA-427C-B43E-6274A8CA6C95")> _
Public Interface Process2 _
    Inherits Process
[GuidAttribute("95AC1923-6EAA-427C-B43E-6274A8CA6C95")]
public interface Process2 : Process
[GuidAttribute(L"95AC1923-6EAA-427C-B43E-6274A8CA6C95")]
public interface class Process2 : Process
[<GuidAttribute("95AC1923-6EAA-427C-B43E-6274A8CA6C95")>]
type Process2 =  
    interface
        interface Process
    end
public interface Process2 extends Process
Process2 类型公开以下成员。
属性
| 名称 | 说明 | |
|---|---|---|
| .gif) | Collection | (继承自 Process。) | 
| .gif) | Collection | 获取包含某个对象的集合,该对象支持此属性或包含在此代码构造中。 | 
| .gif) | DTE | (继承自 Process。) | 
| .gif) | DTE | 获取顶级扩展性对象。 | 
| .gif) | IsBeingDebugged | 获取一个值,该值指示程序是否正在调试。 | 
| .gif) | Name | (继承自 Process。) | 
| .gif) | Name | 获取该进程的名称。 | 
| .gif) | Parent | (继承自 Process。) | 
| .gif) | Parent | 获取 Process2 对象的直接父对象。 | 
| .gif) | ProcessID | (继承自 Process。) | 
| .gif) | ProcessID | 获取分配给该进程的 ID 号。 | 
| .gif) | Programs | (继承自 Process。) | 
| .gif) | Programs | 获取 Program 对象的集合。 | 
| .gif) | Threads | 获取 Thread 对象的集合。 | 
| .gif) | Transport | 获取正用于调试该进程的 Transport。 | 
| .gif) | TransportQualifier | 计算机名称或 IP 地址。 | 
| .gif) | UserName | 
页首
方法
| 名称 | 说明 | |
|---|---|---|
| .gif) | Attach() | (继承自 Process。) | 
| .gif) | Attach() | 使调试器附加该进程。 | 
| .gif) | Attach2 | 与 Attach 类似,会使调试器附加该进程,只有它允许您指定一个或一组引擎。 | 
| .gif) | Break(Boolean) | (继承自 Process。) | 
| .gif) | Break(Boolean) | 使给定进程暂停执行以便可以分析其当前状态。 | 
| .gif) | Detach(Boolean) | (继承自 Process。) | 
| .gif) | Detach(Boolean) | 使调试器与该进程分离。 | 
| .gif) | Terminate(Boolean) | (继承自 Process。) | 
| .gif) | Terminate(Boolean) | 终止该进程。 | 
页首
示例
' Macro code.
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
End Module