Compartir a través de


Debugger3.LocalProcesses Property

Gets the list of processes that currently running on this computer.

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

Syntax

'Declaration
ReadOnly Property LocalProcesses As Processes
Processes LocalProcesses { get; }
property Processes^ LocalProcesses {
    Processes^ get ();
}
abstract LocalProcesses : Processes with get
function get LocalProcesses () : Processes

Property Value

Type: EnvDTE.Processes
A Processes collection.

Remarks

LocalProcesses gets a Processes collection that contains a list of processes that are running on this computer. Each process in the list might or might not be currently debugged. To get the subset of processes that are currently being debugged, use the DebuggedProcesses.

Examples

The following example shows how to use the LocalProcesses property.

To test this property:

  1. Open the target project and run the add-in.
public static void LocalProcesses(EnvDTE80.DTE2 dte)
{
    // Setup debug Output window.
    Window w = 
    (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Local Processes 
    Test");
    owp.Activate();

    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;
    EnvDTE.Processes processes = debugger.LocalProcesses;
    if (processes.Count == 0)
        owp.OutputString("No processes are running on this machine.");
    else
    {
        owp.OutputString("Processes running on this machine:");
        foreach (EnvDTE90.Process2 proc in processes)
            owp.OutputString("\nProcess: [" + proc.ProcessID + "] " + 
                             proc.Name);
    }
}
Sub AttachToCalc()

    ' This function attaches to calc.exe if it is running.

    Dim attached As Boolean = False

    Dim proc As EnvDTE.Process
    For Each proc In DTE2.Debugger.LocalProcesses
        If (Right(proc.Name, 8) = "calc.exe") Then
            proc.Attach()
            attached = True
            Exit For
        End If
    Next

    If attached = False Then
        MsgBox("calc.exe is not running")
    End If
End Sub

.NET Framework Security

See Also

Reference

Debugger3 Interface

EnvDTE90 Namespace