Share via


Debugger2.CurrentProcess プロパティ

アクティブなプロセスを取得するか、または設定します。

名前空間:  EnvDTE80
アセンブリ:  EnvDTE80 (EnvDTE80.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 オブジェクト。

解説

アクティブ プロセスとは、デバッガーによって表示されるデータを定義するプロセスです。 デバッガーは一度に複数のプロセスをデバッグできますが、アクティブにできるプロセスは常に 1 つだけです。 詳細については、「<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: ");
    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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Debugger2 インターフェイス

EnvDTE80 名前空間