获取或设置活动进程。
命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)
语法
声明
Property CurrentProcess As Process
    Get
    Set
Process CurrentProcess { get; set; }
property Process^ CurrentProcess {
    Process^ get ();
    void set (Process^ value);
}
abstract CurrentProcess : Process with get, set
function get CurrentProcess () : Process
function set CurrentProcess (value : Process)
属性值
类型:EnvDTE.Process
一个 Process 对象。
实现
备注
活动进程即定义调试器所显示的数据的进程。 尽管调试器支持同时调试多个进程,但在任意给定时刻只能有一个进程处于活动状态。 有关更多信息,请参见 调试多个进程。
示例
下面的示例演示如何使用 CurrentProcess 属性。
测试此属性:
- 打开目标应用程序。 运行外接程序。 - 没有任何进程正在调试。 
- 在目标应用程序中设置一个断点。 以调试模式运行此应用程序。 
- 当此程序停在该断点处时,运行外接程序。 - 正在调试该进程。 
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: ");
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;
    EnvDTE80.Process2 process = (EnvDTE80.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 = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object
    Dim proc As EnvDTE.Process2
    proc = DTE2.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
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。