Compartilhar via


Process2.Name Property

Definition

Gets the name of the process.

public:
 property System::String ^ default { System::String ^ get(); };
public:
 property Platform::String ^ default { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(0)]
public string this { [System.Runtime.InteropServices.DispId(0)] get; }
[<System.Runtime.InteropServices.DispId(0)>]
[<get: System.Runtime.InteropServices.DispId(0)>]
member this.Name : string
Default Public ReadOnly Property Name As String

Property Value

A string representing the name of the process.

Implements

Attributes

Examples

' Macro code.  
Imports EnvDTE  
Imports EnvDTE80  
Imports System.Diagnostics  
Imports Microsoft.VisualBasic.ControlChars  

Public Module Module1  

    Sub DefaultAttachToLocalCalc()  
        Dim dbg2 As EnvDTE80.Debugger2  
        dbg2 = DTE.Debugger  

        Dim attached As Boolean = False  
        Dim proc As EnvDTE80.Process2  
        For Each proc In DTE.Debugger.LocalProcesses  
            If (Right(proc.Name, 8) = "calc.exe") Then  
                proc.Attach2()  
                attached = True  
                Exit For  
            End If  
        Next  

        If attached = False Then  
            If attached = False Then  
                MsgBox("calc.exe isn't running")  
            End If  
        End If  
    End Sub  
End Module  

Applies to