Share via


Process2 Interface

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

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
<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

The Process2 type exposes the following members.

Properties

  Name Description
Public property Collection Gets the collection containing the object supporting this property or contained within this code construct.
Public property DTE Gets the top-level extensibility object.
Public property IsBeingDebugged Gets a value indicating if the program is being debugged.
Public property Name Gets the name of the process.
Public property Parent Gets the immediate parent object of a Process2 object.
Public property ProcessID Gets the ID number assigned to this process.
Public property Programs Gets a collection of Program objects.
Public property Threads Gets a collection of Thread objects.
Public property Transport Gets the Transport being used to debug this process.
Public property TransportQualifier A computer name or an IP address.
Public property UserName

Top

Methods

  Name Description
Public method Attach Causes the debugger to attach this process.
Public method Attach2 Similar to Attach, causes the debugger to attach this process, only it allows you to specify an engine or set of engines.
Public method Break Causes the given process to pause its execution so that its current state can be analyzed.
Public method Detach Causes the debugger to detach from this process.
Public method Terminate Terminates this process.

Top

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

See Also

Reference

EnvDTE80 Namespace

Process

Other Resources

Automation Object Model Chart