다음을 통해 공유


Debugger.LocalProcesses Property

Definition

Gets the list of processes currently running on this machine.

public:
 property EnvDTE::Processes ^ LocalProcesses { EnvDTE::Processes ^ get(); };
[System.Runtime.InteropServices.DispId(113)]
public EnvDTE.Processes LocalProcesses { [System.Runtime.InteropServices.DispId(113)] get; }
[<System.Runtime.InteropServices.DispId(113)>]
[<get: System.Runtime.InteropServices.DispId(113)>]
member this.LocalProcesses : EnvDTE.Processes
Public ReadOnly Property LocalProcesses As Processes

Property Value

A Processes collection.

Attributes

Examples

The following example demonstrates how to use the LocalProcesses property.

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  

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.

Applies to