共用方式為


Debugger3.CurrentProgram 屬性

設定或傳回現用的程式。

命名空間:  EnvDTE90
組件:  EnvDTE90 (在 EnvDTE90.dll 中)

語法

'宣告
Property CurrentProgram As Program
Program CurrentProgram { get; set; }
property Program^ CurrentProgram {
    Program^ get ();
    void set (Program^ value);
}
abstract CurrentProgram : Program with get, set
function get CurrentProgram () : Program 
function set CurrentProgram (value : Program)

屬性值

類型:Program
Program 物件。

備註

現用的程式是定義偵錯工具所顯示資料的程式。 雖然偵錯工具支援同時偵錯一個以上處理序,但在任何時候都只有一個處理序是現用的。 如需詳細資訊,請參閱<PAVEOVER> 偵錯多重處理序

範例

Sub DumpStacks()
    ' This macro dumps the stack for each thread 
    ' running in the current program to the 
    ' Command window.  The output format is identical 
    ' to that of the call-stack window except the current
    ' line is not printed.
    Dim d As EnvDTE90.Debugger3
    d = dte.Debugger3
    Dim ow As CommandWindow
    ow = dte.Windows.Item(Constants.vsWindowKindCommandWindow).Object

    If d.CurrentProgram Is Nothing Then
        ow.OutputString("No program is currently being debugged." + _
        vbCrLf)
    Else
        Dim MyThread As Thread
        ow.OutputString("Current Program: " + d.CurrentProgram.Name + _
        vbCrLf)

        For Each MyThread In d.CurrentProgram.Threads
            ow.OutputString("" + vbTab + "Thread _
            (" + Str(MyThread.ID) + " ) " + MyThread.Name + vbCrLf)

            Dim MyFrame As EnvDTE.StackFrame
            For Each MyFrame In MyThread.StackFrames
                Dim strModule As String
                Dim pos As Integer = InStrRev(MyFrame.Module, "\")
                If pos > 0 Then
                    strModule = Right(MyFrame.Module, _
                    Len(MyFrame.Module) - pos)
                Else
                    strModule = MyFrame.Module
                End If

                Dim strFName As String = MyFrame.FunctionName
                'Create the argument list.
                Dim strArgs As String
                Dim MyArg As Expression
                Dim i = 0
                For Each MyArg In MyFrame.Arguments
                    If i > 0 Then
                        strArgs = strArgs + ", "
                    End If
                    strArgs = strArgs + MyArg.Type + " " + _
                    MyArg.Name + "=" + MyArg.Value
                    i = i + 1
                Next
                'Output the frame information.
                ow.OutputString("" + vbTab + vbTab + strModule + ": _
                " + strFName + "(" + strArgs + ")" + vbCrLf)
            Next
        Next
    End If
End Sub

.NET Framework 安全性

請參閱

參考

Debugger3 介面

EnvDTE90 命名空間