Share via


Proprietà Debugger2.CurrentProcess

Ottiene o imposta il processo attivo.

Spazio dei nomi:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Sintassi

'Dichiarazione
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)

Valore proprietà

Tipo: EnvDTE.Process
In Process oggetto.

Note

Il processo attivo è il processo che definisce i dati visualizzata dal debugger.Sebbene il debugger supporta il debug più di un processo alla volta, solo uno di processo può essere attivo in un determinato momento.vedere Debug di più processi per ulteriori informazioni.

Esempi

Nell'esempio seguente viene illustrato come utilizzare CurrentProcess proprietà.

Per verificare questa proprietà:

  1. aprire l'applicazione di destinazione.eseguire il componente aggiuntivo.

    Alcun processo sottoposto a debug.

  2. Impostare un punto di interruzione nell'applicazione di destinazione.Eseguire l'applicazione in modalità di debug.

  3. Quando il programma si interrompe al punto di interruzione, eseguire il componente aggiuntivo.

    Il processo sottoposto a debug.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Debugger2 Interfaccia

Overload CurrentProcess

Spazio dei nomi EnvDTE80