Condividi tramite


Proprietà Debugger3.CurrentProcess

Ottiene o imposta il processo attivo.

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

Sintassi

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

Valore proprietà

Tipo: EnvDTE.Process
Un oggetto Process.

Implementa

Debugger2.CurrentProcess

Note

Il processo attivo è il processo mediante il quale vengono definiti i dati visualizzati dal debugger. Sebbene sia possibile eseguire il debug di più processi alla volta, in un determinato momento può essere attivo un solo processo. Per ulteriori informazioni, vedere Debugging Multiple Processes.

Esempi

Nell'esempio riportato di seguito viene mostrato come utilizzare la proprietà CurrentProcess.

Per verificare la proprietà:

  1. Aprire l'applicazione di destinazione. Eseguire il componente aggiuntivo.

    Non viene eseguito il debug di alcun processo.

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

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

    È in corso il debug del processo.

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

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Debugger3 Interfaccia

Overload CurrentProcess

Spazio dei nomi EnvDTE90