Compartilhar via


Debugger3.CurrentProcess Property

Definition

Gets or sets the active process.

public:
 property EnvDTE::Process ^ CurrentProcess { EnvDTE::Process ^ get(); void set(EnvDTE::Process ^ value); };
public:
 property EnvDTE::Process ^ CurrentProcess { EnvDTE::Process ^ get(); void set(EnvDTE::Process ^ value); };
[System.Runtime.InteropServices.DispId(103)]
public EnvDTE.Process CurrentProcess { [System.Runtime.InteropServices.DispId(103)] get; [System.Runtime.InteropServices.DispId(103)] set; }
[<System.Runtime.InteropServices.DispId(103)>]
[<get: System.Runtime.InteropServices.DispId(103)>]
[<set: System.Runtime.InteropServices.DispId(103)>]
member this.CurrentProcess : EnvDTE.Process with get, set
Public Property CurrentProcess As Process

Property Value

A Process object.

Implements

Attributes

Examples

The following example shows how to use the CurrentProcess property.

public static void CurrentProcess(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("Current Process   
    Test");  
    owp.Activate();  

    owp.OutputString("Current Process Info: ");  
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;  
    EnvDTE90.Process2 process = (EnvDTE90.Process2)debugger.CurrentProcess;  

    if (process == null)  
        owp.OutputString("No process is being debugged");  
    else  
        owp.OutputString("Process ID = " + process.ProcessID +  
                         "  Process Name = " + process.Name);  
}  
Sub ShowCurrentProcess()  
    ' This function displays the current debugger  
    ' mode in the output window.  
    Dim ow As OutputWindow  
    ow = dte.Windows.Item(Constants.vsWindowKindOutput).Object  

    Dim proc As EnvDTE90.Process3  
    proc = dte.Debugger.CurrentProcess  

    If (proc Is Nothing) Then  
        ow.ActivePane.OutputString("No process is being debugged")  
    Else  
        ow.ActivePane.OutputString("" + Str(proc.ProcessID) + ": " + _  
        poc.Name + vbCrLf)  
    End If  
End Sub  

Remarks

The active process is the process that defines the data displayed by the debugger. Although the debugger supports debugging more than one process at a time, only one process can be active at any given time. For more information, see Debugging Multiple Programs.

Applies to