Compartilhar via


Debugger.LocalProcesses Property

Gets the list of processes currently running on this machine.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.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 returns a Processes collection containing a list of processes running on this machine. Each process in the list might or might not be currently debugged. To get the subset of processes that are being currently debugged, use the DebuggedProcesses property.

Examples

The following example demonstrates how to use the LocalProcesses property.

To test this property:

  1. Open the target project and run the add-in.
public static void LocalProcesses(DTE dte)
{
    // Setup the 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();

    EnvDTE.Processes processes = dte.Debugger.LocalProcesses;
    if(processes.Count == 0)
        owp.OutputString("No processes are running on this machine.");
    else
    {
        owp.OutputString("Processes running on this machine:");
        foreach(EnvDTE.Process proc in processes)
            owp.OutputString("\nProcess: [" + proc.ProcessID + "] " + 
                             proc.Name);
    }
}
Shared Sub LocalProcesses(ByRef dte As EnvDTE.DTE)
    Dim processes As EnvDTE.Processes = dte.Debugger.LocalProcesses
    If processes.Count = 0 Then
        MessageBox.Show("No processes are running on this machine.", _
                        "Debugger Test - Local Processes Test")
    Else
        Dim str As String = "Processes running on this machine:"
        For Each proc As EnvDTE.Process In processes
            str += vbCrLf + "Process: [" + proc.ProcessID.ToString() + "] " + _
                   proc.Name.ToString()
        Next
        MessageBox.Show(str, "Debugger Test - Local Processes Test")
    End If
End Sub

.NET Framework Security

See Also

Reference

Debugger Interface

EnvDTE Namespace