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)

[GuidAttribute("95AC1923-6EAA-427C-B43E-6274A8CA6C95")]
public interface Process2 : Process

NameDescription
System_CAPS_pubpropertyCollection

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

System_CAPS_pubpropertyDTE

Gets the top-level extensibility object.

System_CAPS_pubpropertyIsBeingDebugged

Gets a value indicating if the program is being debugged.

System_CAPS_pubpropertyName

Gets the name of the process.

System_CAPS_pubpropertyParent

Gets the immediate parent object of a Process2 object.

System_CAPS_pubpropertyProcessID

Gets the ID number assigned to this process.

System_CAPS_pubpropertyPrograms

Gets a collection of Program objects.

System_CAPS_pubpropertyThreads

Gets a collection of Thread objects.

System_CAPS_pubpropertyTransport

Gets the Transport being used to debug this process.

System_CAPS_pubpropertyTransportQualifier

A computer name or an IP address.

System_CAPS_pubpropertyUserName

NameDescription
System_CAPS_pubmethodAttach()

Causes the debugger to attach this process.

System_CAPS_pubmethodAttach2(Object)

Similar to Attach, causes the debugger to attach this process, only it allows you to specify an engine or set of engines.

System_CAPS_pubmethodBreak(Boolean)

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

System_CAPS_pubmethodDetach(Boolean)

Causes the debugger to detach from this process.

System_CAPS_pubmethodTerminate(Boolean)

Terminates this process.

' 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
Return to top
Show: