Debugger2.LocalProcesses Property
Gets the list of processes currently running on this machine.
Namespace: EnvDTE80
Assembly: EnvDTE80 (in EnvDTE80.dll)
Syntax
'Declaration
ReadOnly Property LocalProcesses As Processes
Processes LocalProcesses { get; }
property Processes^ LocalProcesses {
Processes^ get ();
}
abstract LocalProcesses : Processes
function get LocalProcesses () : Processes
Property Value
Type: EnvDTE.Processes
A Processes collection.
Implements
Remarks
LocalProcesses gets 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 currently being debugged, use the DebuggedProcesses.
Examples
The following example demonstrates how to use the LocalProcesses property.
To test this property, 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();
EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)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 (EnvDTE80.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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.