Compartir a través de


Debugger.CurrentProcess Property

Definition

Sets or gets 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.

Attributes

Examples

The following example demonstrates how to use the CurrentProcess property.

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

    owp.OutputString("Current Process Info: ");  
    EnvDTE.Process process = dte.Debugger.CurrentProcess;  
    if(process == null)  
        owp.OutputString("No process is being debugged");  
    else  
        owp.OutputString("Process ID = " + process.ProcessID +   
                         "  Process Name = " + process.Name);  
}  
Shared Sub CurrentProcess(ByRef dte As EnvDTE.DTE)  
     Dim process As EnvDTE.Process = dte.Debugger.CurrentProcess  
     If process Is Nothing Then  
         MessageBox.Show("No process is being debugged", "Debugger Test")  
     Else  
         MessageBox.Show("Process ID = " + process.ProcessID.ToString() + _  
                         "  Process Name = " + process.Name, "Debugger Test")  
     End If  
 End Sub  

Remarks

CurrentProcess sets or returns the active Process. 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. See Debugging Multiple Programs for more information.

Applies to