共用方式為


Process2 Interface

Definition

The Process2 object is used to examine and manipulate processes. The Process2 object supersedes the Process object.

public interface class Process2 : EnvDTE::Process
public interface class Process2 : EnvDTE::Process
__interface Process2 : EnvDTE::Process
[System.Runtime.InteropServices.Guid("95AC1923-6EAA-427C-B43E-6274A8CA6C95")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface Process2 : EnvDTE.Process
[System.Runtime.InteropServices.Guid("95AC1923-6EAA-427C-B43E-6274A8CA6C95")]
public interface Process2 : EnvDTE.Process
[<System.Runtime.InteropServices.Guid("95AC1923-6EAA-427C-B43E-6274A8CA6C95")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type Process2 = interface
    interface Process
[<System.Runtime.InteropServices.Guid("95AC1923-6EAA-427C-B43E-6274A8CA6C95")>]
type Process2 = interface
    interface Process
Public Interface Process2
Implements Process
Derived
Attributes
Implements

Examples

' 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  

Properties

Collection

Gets the collection containing the object supporting this property or contained within this code construct.

DTE

Gets the top-level extensibility object.

IsBeingDebugged

Gets a value indicating if the program is being debugged.

Name

Gets the name of the process.

Parent

Gets the immediate parent object of a Process2 object.

ProcessID

Gets the ID number assigned to this process.

Programs

Gets a collection of Program objects.

Threads

Gets a collection of Thread objects.

Transport

Gets the Transport being used to debug this process.

TransportQualifier

A computer name or an IP address.

UserName

Methods

Attach()

Causes the debugger to attach this process.

Attach2(Object)
Break(Boolean)

Causes the given process to pause its execution so that its current state can be analyzed.

Detach(Boolean)

Causes the debugger to detach from this process.

Terminate(Boolean)

Terminates this process.

Applies to