Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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
/** @attribute GuidAttribute("95AC1923-6EAA-427C-B43E-6274A8CA6C95") */ 
public interface Process2 extends Process
GuidAttribute("95AC1923-6EAA-427C-B43E-6274A8CA6C95") 
public interface Process2 extends 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
Show:
© 2015 Microsoft