共用方式為


Debugger3.CurrentProcess 屬性

取得或設定現用的處理序。

命名空間:  EnvDTE90
組件:  EnvDTE90 (在 EnvDTE90.dll 中)

語法

'宣告
Property CurrentProcess As Process
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)

屬性值

類型:Process
Process 物件。

備註

現用的處理序是定義偵錯工具所顯示資料的處理序。 雖然偵錯工具支援同時偵錯一個以上處理序,但在任何時候都只有一個處理序是現用的。 如需詳細資訊,請參閱<PAVEOVER> 偵錯多重處理序

範例

在下列範例中,示範了如何使用 CurrentProcess 屬性。

若要測試這個屬性:

  1. 開啟目標應用程式。 執行增益集。

    沒有任何處理序正在進行偵錯。

  2. 請在目標應用程式中設定中斷點。 以偵錯模式執行應用程式。

  3. 當程式在中斷點上停止時,請執行增益集。

    處理序正在進行偵錯。

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

.NET Framework 安全性

請參閱

參考

Debugger3 介面

EnvDTE90 命名空間