次の方法で共有


Process.Name プロパティ

オブジェクトの名前を取得します。

名前空間:  EnvDTE
アセンブリ:  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Default Property Name As String
    Get
string this { get; }
property String^ default {
    String^ get ();
}
abstract Name : string
function get Name () : String

プロパティ値

型: System.String
オブジェクトの名前を表す文字列。

Name プロパティの使用方法を次の例に示します。

このプロパティをテストするには

  1. ターゲット アプリケーションにブレークポイントを設定します。

  2. ターゲット アプリケーションをデバッグ モードで実行します。

  3. ブレークポイントでアプリケーションが停止したら、アドインを実行します。

public static void Name(DTE 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("Name Property Test");
    owp.Activate();
    owp.OutputString("\nEdition of the environment: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).DTE.Edition);
    owp.OutputString("\nThe name of the current program: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).Name);
    owp.OutputString("\nThe name of the current program: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).Parent.CurrentProgram.Name);
    owp.OutputString("\nProcess ID: " + 
                        dte.Debugger.DebuggedProcesses.Item(1).ProcessID);
    EnvDTE.Programs programs = 
                        dte.Debugger.DebuggedProcesses.Item(1).Programs;
    owp.OutputString("\nThe name of the current program: " + 
                        programs.Item(1).Name);
}
Shared Sub Name(ByRef dte As EnvDTE.DTE)
    Dim str As String
    Dim processes As EnvDTE.Processes = dte.Debugger.DebuggedProcesses
    str = "Edition of the environment: " + processes.Item(1).DTE.Edition
    str += vbCrLf + "The name of the current program: " + _
           processes.Item(1).Name
    str += vbCrLf + "The name of the current program: " + _
           processes.Item(1).Parent.CurrentProgram.Name
    str += vbCrLf + "Process ID: " + processes.Item(1).ProcessID.ToString()
    str += vbCrLf + "The name of the current program: " + _
           processes.Item(1).Programs.Item(1).Name
    MessageBox.Show(str, "Name Property Test")
End Sub

.NET Framework セキュリティ

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

参照

参照

Process インターフェイス

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する